├── python ├── sqlalchemy │ ├── demo │ │ ├── db │ │ │ ├── __init__.py │ │ │ ├── curd.py │ │ │ ├── models.py │ │ │ ├── config.py │ │ │ └── base.py │ │ └── main.py │ ├── requirements.txt │ ├── run.sh │ └── img │ │ ├── 1.png │ │ ├── 2.png │ │ └── 3.png ├── pymysql │ ├── requirements.txt │ ├── run.sh │ ├── README-CN.md │ └── example.py ├── mysql-connector-python │ ├── requirements.txt │ └── run.sh └── README.md ├── applications ├── hertzbeat │ ├── web-app │ │ ├── src │ │ │ ├── assets │ │ │ │ ├── .gitkeep │ │ │ │ ├── bg.png │ │ │ │ └── img │ │ │ │ │ └── notification.svg │ │ │ ├── app │ │ │ │ ├── routes │ │ │ │ │ ├── setting │ │ │ │ │ │ ├── define │ │ │ │ │ │ │ └── define.component.less │ │ │ │ │ │ ├── status │ │ │ │ │ │ │ └── status.component.less │ │ │ │ │ │ └── settings │ │ │ │ │ │ │ ├── object-store │ │ │ │ │ │ │ └── object-store.component.less │ │ │ │ │ │ │ ├── message-server │ │ │ │ │ │ │ └── message-server.component.less │ │ │ │ │ │ │ └── system-config │ │ │ │ │ │ │ └── system-config.component.less │ │ │ │ │ ├── alert │ │ │ │ │ │ ├── alert-converge │ │ │ │ │ │ │ └── alert-converge.component.less │ │ │ │ │ │ └── alert-silence │ │ │ │ │ │ │ └── alert-silence.component.less │ │ │ │ │ ├── monitor │ │ │ │ │ │ ├── monitor-list │ │ │ │ │ │ │ └── monitor-list.component.less │ │ │ │ │ │ ├── monitor-data-table │ │ │ │ │ │ │ └── monitor-data-table.component.less │ │ │ │ │ │ └── monitor-detail │ │ │ │ │ │ │ └── monitor-detail.component.less │ │ │ │ │ ├── passport │ │ │ │ │ │ └── lock │ │ │ │ │ │ │ └── lock.component.less │ │ │ │ │ ├── exception │ │ │ │ │ │ ├── exception.component.ts │ │ │ │ │ │ ├── exception-routing.module.ts │ │ │ │ │ │ └── exception.module.ts │ │ │ │ │ └── status-public │ │ │ │ │ │ └── status-public.component.less │ │ │ │ ├── shared │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── components │ │ │ │ │ │ ├── key-value-input │ │ │ │ │ │ │ └── key-value-input.component.less │ │ │ │ │ │ └── metrics-field-input │ │ │ │ │ │ │ └── metrics-field-input.component.less │ │ │ │ │ ├── shared-delon.module.ts │ │ │ │ │ ├── json-schema │ │ │ │ │ │ ├── json-schema.module.ts │ │ │ │ │ │ └── test │ │ │ │ │ │ │ └── test.widget.ts │ │ │ │ │ ├── constants.ts │ │ │ │ │ └── pipe │ │ │ │ │ │ ├── timezone.pipe.spec.ts │ │ │ │ │ │ └── elapsed-time.pipe.spec.ts │ │ │ │ ├── core │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── module-import-guard.ts │ │ │ │ │ └── core.module.ts │ │ │ │ ├── layout │ │ │ │ │ ├── blank │ │ │ │ │ │ └── blank.component.ts │ │ │ │ │ ├── basic │ │ │ │ │ │ └── widgets │ │ │ │ │ │ │ └── fullscreen.component.ts │ │ │ │ │ └── passport │ │ │ │ │ │ └── passport.component.ts │ │ │ │ ├── icons-provider.module.ts │ │ │ │ └── pojo │ │ │ │ │ ├── TemplateConfig.ts │ │ │ │ │ ├── Message.ts │ │ │ │ │ ├── SystemConfig.ts │ │ │ │ │ ├── Param.ts │ │ │ │ │ ├── CollectorSummary.ts │ │ │ │ │ ├── AppCount.ts │ │ │ │ │ ├── AlertDefineBind.ts │ │ │ │ │ └── StatusPageComponentStatus.ts │ │ │ ├── favicon.ico │ │ │ ├── typings.d.ts │ │ │ ├── styles │ │ │ │ └── index.less │ │ │ ├── styles.less │ │ │ ├── environments │ │ │ │ ├── environment.prod.ts │ │ │ │ └── environment.ts │ │ │ ├── style-icons.ts │ │ │ ├── test.ts │ │ │ └── main.ts │ │ ├── ng-alain.json │ │ ├── .prettierignore │ │ ├── .prettierrc.js │ │ ├── .editorconfig │ │ ├── tsconfig.app.json │ │ ├── tsconfig.spec.json │ │ ├── .eslintignore │ │ ├── .browserslistrc │ │ ├── .stylelintrc │ │ ├── tsconfig.json │ │ └── README.md │ ├── manager │ │ └── src │ │ │ ├── test │ │ │ └── resources │ │ │ │ └── mockito-extensions │ │ │ │ └── org.mockito.plugins.MockMaker │ │ │ └── main │ │ │ ├── resources │ │ │ ├── banner.txt │ │ │ └── templates │ │ │ │ ├── 6-FlyBookRobotTemplate.txt │ │ │ │ ├── 9-DiscordBotTemplate.txt │ │ │ │ ├── 8-SlackTemplate.txt │ │ │ │ ├── 10-WeWorkAppTemplate.txt │ │ │ │ ├── 4-WeWorkRobotTemplate.txt │ │ │ │ ├── 7-TelegramBotTemplate.txt │ │ │ │ ├── 11-HuaweiCloudSmnTemplate.txt │ │ │ │ ├── 13-GotifyTemplate.txt │ │ │ │ ├── 12-ServerChanTemplate.txt │ │ │ │ ├── 5-DingTalkRobotTemplate.txt │ │ │ │ └── 2-WebhookTemplate.txt │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── hertzbeat │ │ │ └── manager │ │ │ └── service │ │ │ └── NoticeDispatchService.java │ ├── plugin │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.apache.hertzbeat.plugin.Plugin │ ├── NOTICE │ ├── material │ │ └── licenses │ │ │ ├── NOTICE │ │ │ ├── backend │ │ │ ├── LICENSE-reactive-streams.txt │ │ │ ├── LICENSE-mssql-jdbc.txt │ │ │ └── LICENSE-taos-jdbcdriver.txt │ │ │ └── frontend │ │ │ ├── LICENSE-tslib.txt │ │ │ ├── LICENSE-internmap.txt │ │ │ ├── LICENSE-d3-array.txt │ │ │ ├── LICENSE-d3-color.txt │ │ │ ├── LICENSE-d3-dsv.txt │ │ │ ├── LICENSE-d3-path.txt │ │ │ ├── LICENSE-d3-shape.txt │ │ │ ├── LICENSE-d3-timer.txt │ │ │ ├── LICENSE-d3-hierarchy.txt │ │ │ ├── LICENSE-d3-interpolate.txt │ │ │ ├── LICENSE-topojson-client.txt │ │ │ ├── LICENSE-simple-statistics.txt │ │ │ ├── LICENSE-inherits.txt │ │ │ ├── LICENSE-tinycolor.txt │ │ │ ├── LICENSE-lie.txt │ │ │ ├── LICENSE-csstype.txt │ │ │ ├── LICENSE-dagre.txt │ │ │ ├── LICENSE-graphlib.txt │ │ │ ├── LICENSE-hotkey.txt │ │ │ ├── LICENSE-FileSaver.js.txt │ │ │ ├── LICENSE-core-js.txt │ │ │ ├── LICENSE-attr.txt │ │ │ ├── LICENSE-coord.txt │ │ │ ├── LICENSE-g2.txt │ │ │ ├── LICENSE-scale.txt │ │ │ ├── LICENSE-screenfull.txt │ │ │ ├── LICENSE-util.txt │ │ │ ├── LICENSE-adjust.txt │ │ │ ├── LICENSE-component.txt │ │ │ ├── LICENSE-data-set.txt │ │ │ ├── LICENSE-iconv-lite.txt │ │ │ ├── LICENSE-plyr.txt │ │ │ ├── LICENSE-process-nextick-args.txt │ │ │ ├── LICENSE-slick.txt │ │ │ ├── LICENSE-core-util-is.txt │ │ │ ├── LICENSE-gl-matrix.txt │ │ │ ├── LICENSE-hierarchy.txt │ │ │ ├── LICENSE-ngx-echarts.txt │ │ │ └── LICENSE-ajv-formats.txt │ ├── collector │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── banner.txt │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── hertzbeat │ │ │ └── collector │ │ │ └── collect │ │ │ └── redfish │ │ │ └── Session.java │ ├── script │ │ ├── helm │ │ │ └── hertzbeat │ │ │ │ ├── .helmignore │ │ │ │ └── templates │ │ │ │ └── tsdb │ │ │ │ └── configmap.yaml │ │ ├── docker-compose │ │ │ ├── README.md │ │ │ ├── hertzbeat-mysql-iotdb │ │ │ │ ├── conf │ │ │ │ │ └── sql │ │ │ │ │ │ └── schema.sql │ │ │ │ └── README_CN.md │ │ │ ├── hertzbeat-mysql-tdengine │ │ │ │ └── conf │ │ │ │ │ └── sql │ │ │ │ │ └── schema.sql │ │ │ ├── hertzbeat-mysql-victoria-metrics │ │ │ │ ├── conf │ │ │ │ │ └── sql │ │ │ │ │ │ └── schema.sql │ │ │ │ └── README_CN.md │ │ │ └── hertzbeat-postgresql-iotdb │ │ │ │ └── README_CN.md │ │ ├── ext-lib │ │ │ └── README │ │ └── docker │ │ │ ├── server │ │ │ └── README.md │ │ │ └── collector │ │ │ └── README.md │ ├── e2e │ │ ├── data │ │ │ ├── monitor-ping.json │ │ │ ├── monitor-ssl.json │ │ │ ├── monitor-port.json │ │ │ ├── monitor-udp.json │ │ │ ├── monitor-sitemap.json │ │ │ ├── monitor-ftp.json │ │ │ └── monitor-website.json │ │ ├── README.md │ │ ├── Makefile │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── DISCLAIMER │ ├── push │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring.factories │ ├── common │ │ └── src │ │ │ ├── main │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── hertzbeat │ │ │ └── common │ │ │ └── util │ │ │ ├── Base64UtilTest.java │ │ │ └── LruHashMapTest.java │ ├── warehouse │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring.factories │ └── alerter │ │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── spring.factories ├── mydata │ ├── .gitignore │ ├── main.go │ ├── cmd │ │ ├── version.go │ │ ├── root.go │ │ └── hex.go │ ├── internal │ │ ├── dbinfo │ │ │ ├── keyrange_test.go │ │ │ └── mysql.go │ │ ├── transfor │ │ │ ├── transfor.go │ │ │ ├── transfor_test.go │ │ │ └── stdiconv.go │ │ ├── version │ │ │ └── version.go │ │ ├── file │ │ │ ├── merge.go │ │ │ └── outfile.go │ │ └── crypto │ │ │ └── crypto_test.go │ ├── Makefile │ └── go.mod ├── sveltekit │ ├── src │ │ ├── global.d.ts │ │ ├── styles │ │ │ ├── tailwind.css │ │ │ └── tailwind-output.css │ │ ├── stores │ │ │ └── authStore.js │ │ ├── app.css │ │ ├── components │ │ │ ├── Navbar.svelte │ │ │ ├── Icons.svelte │ │ │ ├── Todo.svelte │ │ │ ├── TodoForm.svelte │ │ │ └── Auth.svelte │ │ ├── app.html │ │ ├── routes │ │ │ ├── +page.svelte │ │ │ ├── +layout.svelte │ │ │ └── api │ │ │ │ └── todos │ │ │ │ └── +page.server.js │ │ └── lib │ │ │ └── db.js │ ├── static │ │ └── favicon.png │ ├── postcss.config.cjs │ ├── vite.config.mjs │ ├── jsconfig.json │ ├── tailwind.config.cjs │ ├── svelte.config.js │ └── README.md └── README.md ├── java ├── mybatis │ ├── run.sh │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── oceanbase │ │ │ └── samples │ │ │ ├── mapper │ │ │ └── UserMapper.java │ │ │ └── util │ │ │ └── SqlSessionUtil.java │ │ └── resources │ │ ├── init.sql │ │ ├── mybatis-config.xml │ │ └── UserMapper.xml ├── mybatis-plus │ ├── run.sh │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── oceanbase │ │ │ └── samples │ │ │ └── mybatisplus │ │ │ ├── Person.java │ │ │ ├── PersonMapper.java │ │ │ └── MybatisPlusJavaApplication.java │ │ └── resources │ │ └── init.sql ├── spring-jdbc │ ├── run.sh │ └── src │ │ └── test │ │ └── resources │ │ └── init.sql ├── springboot │ ├── run.sh │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── init.sql │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── oceanbase │ │ │ └── samples │ │ │ └── springboot │ │ │ ├── SpringBootJavaApplication.java │ │ │ ├── repository │ │ │ └── StaffEntityRepository.java │ │ │ └── entity │ │ │ └── StaffEntity.java │ │ └── test │ │ └── java │ │ └── com │ │ └── oceanbase │ │ └── samples │ │ └── springboot │ │ └── SpringBootJavaApplicationTest.java ├── testcontainers-java │ ├── run.sh │ └── src │ │ └── test │ │ └── resources │ │ └── log4j2-test.properties ├── README.md ├── mysql-connector-java │ ├── run.sh │ └── pom.xml └── oceanbase-client │ ├── run.sh │ └── pom.xml ├── javascript ├── sequelize │ ├── run.sh │ └── package.json ├── typeorm │ ├── run.sh │ ├── tsconfig.json │ ├── package.json │ ├── index.ts │ └── README-CN.md ├── drizzle │ ├── .env │ ├── run.sh │ ├── drizzle.config.ts │ ├── db │ │ └── schema.ts │ ├── tsconfig.json │ ├── package.json │ ├── index.ts │ └── README-CN.md ├── README.md ├── prisma │ ├── .env │ ├── run.sh │ ├── package.json │ ├── index.ts │ └── prisma │ │ └── schema.prisma └── mysql2 │ ├── run.sh │ ├── index.js │ └── README-CN.md ├── ruby ├── mysql2 │ ├── run.sh │ └── example.rb ├── README.md ├── sequel │ ├── run.sh │ ├── example.rb │ ├── README-CN.md │ └── README.md └── activerecord │ ├── run.sh │ └── example.rb ├── php └── README.md ├── rust └── README.md ├── golang ├── README.md ├── go-sql-driver │ ├── run.sh │ ├── go.mod │ ├── go.sum │ └── README-CN.md └── gorm │ ├── run.sh │ ├── go.mod │ ├── README-CN.md │ ├── README.md │ └── go.sum ├── c_cplusplus ├── README.md └── mysql-connector-cpp │ └── run.sh ├── .editorconfig ├── .github └── workflows │ ├── cpp.yml │ ├── golang.yml │ ├── ruby.yml │ ├── python.yml │ ├── java.yml │ └── javascript.yml └── .gitignore /python/sqlalchemy/demo/db/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/pymysql/requirements.txt: -------------------------------------------------------------------------------- 1 | pymysql==1.1.1 2 | -------------------------------------------------------------------------------- /java/mybatis/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn test 3 | -------------------------------------------------------------------------------- /javascript/sequelize/run.sh: -------------------------------------------------------------------------------- 1 | npm install 2 | node index.js -------------------------------------------------------------------------------- /applications/mydata/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | testdata/ 3 | vendor/ -------------------------------------------------------------------------------- /java/mybatis-plus/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn test 3 | -------------------------------------------------------------------------------- /java/spring-jdbc/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn test 3 | -------------------------------------------------------------------------------- /java/springboot/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn test 3 | -------------------------------------------------------------------------------- /javascript/typeorm/run.sh: -------------------------------------------------------------------------------- 1 | npm install 2 | npx ts-node index.ts -------------------------------------------------------------------------------- /ruby/mysql2/run.sh: -------------------------------------------------------------------------------- 1 | gem install mysql2 2 | ruby example.rb 3 | -------------------------------------------------------------------------------- /java/testcontainers-java/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn verify 3 | -------------------------------------------------------------------------------- /javascript/drizzle/.env: -------------------------------------------------------------------------------- 1 | DATABASE_URL="mysql://root:@127.0.0.1:2881/test" -------------------------------------------------------------------------------- /python/mysql-connector-python/requirements.txt: -------------------------------------------------------------------------------- 1 | mysql-connector-python==8.0.23 -------------------------------------------------------------------------------- /python/sqlalchemy/requirements.txt: -------------------------------------------------------------------------------- 1 | pymysql==1.1.1 2 | sqlalchemy==2.0.30 3 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/setting/define/define.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/setting/status/status.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/sveltekit/src/global.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /java/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add Java samples in this directory. 4 | -------------------------------------------------------------------------------- /php/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add PHP samples in this directory. 4 | -------------------------------------------------------------------------------- /ruby/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add Ruby samples in this directory. 4 | -------------------------------------------------------------------------------- /ruby/sequel/run.sh: -------------------------------------------------------------------------------- 1 | gem install sequel 2 | gem install mysql2 3 | ruby example.rb 4 | -------------------------------------------------------------------------------- /rust/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add Java samples in this directory. 4 | -------------------------------------------------------------------------------- /golang/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add Golang samples in this directory. 4 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add Python samples in this directory. 4 | -------------------------------------------------------------------------------- /python/pymysql/run.sh: -------------------------------------------------------------------------------- 1 | python3 -m pip install -r requirements.txt 2 | python3 example.py 3 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/alert/alert-converge/alert-converge.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/alert/alert-silence/alert-silence.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /c_cplusplus/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add C or C++ samples in this directory. 4 | -------------------------------------------------------------------------------- /javascript/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add JavaScript samples in this directory. 4 | -------------------------------------------------------------------------------- /python/sqlalchemy/run.sh: -------------------------------------------------------------------------------- 1 | python3 -m pip install -r requirements.txt 2 | python3 example.py 3 | -------------------------------------------------------------------------------- /ruby/activerecord/run.sh: -------------------------------------------------------------------------------- 1 | gem install activerecord 2 | gem install mysql2 3 | ruby example.rb 4 | -------------------------------------------------------------------------------- /applications/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | Please add application samples in this directory. 4 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/setting/settings/object-store/object-store.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/setting/settings/message-server/message-server.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/setting/settings/system-config/system-config.component.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/mysql-connector-python/run.sh: -------------------------------------------------------------------------------- 1 | python3 -m pip install -r requirements.txt 2 | python3 example.py 3 | -------------------------------------------------------------------------------- /javascript/prisma/.env: -------------------------------------------------------------------------------- 1 | DATABASE_URL="mysql://root:@127.0.0.1:2881/test?prefer_socket=false&a=.psdb.cloud" 2 | -------------------------------------------------------------------------------- /python/sqlalchemy/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/python/sqlalchemy/img/1.png -------------------------------------------------------------------------------- /python/sqlalchemy/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/python/sqlalchemy/img/2.png -------------------------------------------------------------------------------- /python/sqlalchemy/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/python/sqlalchemy/img/3.png -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /applications/sveltekit/src/styles/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /golang/go-sql-driver/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd `dirname $0` 3 | CGO_ENABLED=0 GO111MODULE=on go run example.go 4 | -------------------------------------------------------------------------------- /applications/sveltekit/src/stores/authStore.js: -------------------------------------------------------------------------------- 1 | import { writable } from 'svelte/store'; 2 | 3 | export const user = writable(true); 4 | -------------------------------------------------------------------------------- /applications/sveltekit/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/applications/sveltekit/static/favicon.png -------------------------------------------------------------------------------- /javascript/drizzle/run.sh: -------------------------------------------------------------------------------- 1 | npm install 2 | npx drizzle-kit generate --name=init 3 | npx drizzle-kit migrate 4 | npx ts-node index.ts 5 | -------------------------------------------------------------------------------- /applications/sveltekit/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {}, 4 | tailwindcss: {} 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /applications/hertzbeat/plugin/src/main/resources/META-INF/services/org.apache.hertzbeat.plugin.Plugin: -------------------------------------------------------------------------------- 1 | org.apache.hertzbeat.plugin.impl.DemoPluginImpl -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from './shared.module'; 2 | export * from './json-schema/json-schema.module'; 3 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/applications/hertzbeat/web-app/src/favicon.ico -------------------------------------------------------------------------------- /applications/mydata/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "mydata/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.Execute() 9 | } 10 | -------------------------------------------------------------------------------- /javascript/mysql2/run.sh: -------------------------------------------------------------------------------- 1 | mkdir example 2 | cd example 3 | npm init -y 4 | 5 | npm install mysql2 6 | 7 | cp ../index.js ./ 8 | node index.js 9 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/assets/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/ob-samples/HEAD/applications/hertzbeat/web-app/src/assets/bg.png -------------------------------------------------------------------------------- /java/mybatis/src/test/java/com/oceanbase/samples/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.mapper; 2 | 3 | public interface UserMapper { 4 | } 5 | -------------------------------------------------------------------------------- /golang/go-sql-driver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/oceanbase/ob-samples/golang-go-sql-driver 2 | 3 | go 1.19 4 | 5 | require github.com/go-sql-driver/mysql v1.7.0 6 | -------------------------------------------------------------------------------- /golang/gorm/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd `dirname $0` 3 | CGO_ENABLED=0 GO111MODULE=on go run example.go -host 127.0.0.1 -port 2881 -username root@test -database test 4 | -------------------------------------------------------------------------------- /java/mysql-connector-java/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn clean install exec:java -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=com.oceanbase.samples.MySqlConnectorTest 3 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | // # 3rd Party Library 2 | // If the library doesn't have typings available at `@types/`, 3 | // you can still use it by manually adding typings for it 4 | -------------------------------------------------------------------------------- /applications/sveltekit/vite.config.mjs: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vite'; 3 | 4 | export default defineConfig({ 5 | plugins: [sveltekit()], 6 | }); 7 | -------------------------------------------------------------------------------- /applications/sveltekit/src/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | h1, 7 | h2, 8 | h3, 9 | h4 { 10 | @apply font-bold; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /golang/go-sql-driver/go.sum: -------------------------------------------------------------------------------- 1 | github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= 2 | github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= 3 | -------------------------------------------------------------------------------- /applications/hertzbeat/NOTICE: -------------------------------------------------------------------------------- 1 | Apache HertzBeat (incubating) 2 | Copyright 2024 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './i18n/i18n.service'; 2 | export * from './module-import-guard'; 3 | export * from './interceptor/default.interceptor'; 4 | export * from './startup/startup.service'; 5 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/styles/index.less: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @media screen and (max-width: 768px) { 3 | .mobile-hide { 4 | display: none; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/NOTICE: -------------------------------------------------------------------------------- 1 | Apache HertzBeat (incubating) 2 | Copyright 2024 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/monitor/monitor-list/monitor-list.component.less: -------------------------------------------------------------------------------- 1 | @import "~src/styles/theme"; 2 | 3 | .switch-app { 4 | border-radius: 6px; 5 | } 6 | .switch-app:hover { 7 | background-color: @primary-color; 8 | } 9 | -------------------------------------------------------------------------------- /applications/sveltekit/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "$lib": ["src/lib"], 6 | "$lib/*": ["src/lib/*"] 7 | } 8 | }, 9 | "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] 10 | } 11 | -------------------------------------------------------------------------------- /javascript/prisma/run.sh: -------------------------------------------------------------------------------- 1 | export PRISMA_ENGINES_MIRROR=https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com 2 | export BINARY_DOWNLOAD_VERSION=96fa66f2f130d66795d9f79dd431c678a9c7104e 3 | npm install 4 | npx prisma migrate dev --name init 5 | npx ts-node index.ts 6 | -------------------------------------------------------------------------------- /applications/sveltekit/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: ['./src/**/*.html', './src/**/*.svelte'], 3 | darkMode: false, // or 'media' or 'class' 4 | theme: { 5 | extend: {} 6 | }, 7 | variants: { 8 | extend: {} 9 | }, 10 | plugins: [] 11 | }; 12 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/ng-alain.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/ng-alain/schema.json", 3 | "theme": { 4 | "list": [ 5 | { 6 | "theme": "dark" 7 | }, 8 | { 9 | "theme": "compact" 10 | } 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/styles.less: -------------------------------------------------------------------------------- 1 | @import '@delon/theme/system/index'; 2 | @import '@delon/abc/index'; 3 | @import '@delon/theme/layout-default/style/index'; 4 | @import '@delon/theme/layout-blank/style/index'; 5 | 6 | @import './styles/index'; 7 | @import './styles/theme'; 8 | -------------------------------------------------------------------------------- /java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/Person.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.mybatisplus; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Person { 7 | private Integer id; 8 | private String name; 9 | private Integer age; 10 | } 11 | -------------------------------------------------------------------------------- /java/oceanbase-client/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn clean install exec:java -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=com.oceanbase.samples.InsertAndSelectExample 3 | mvn clean install exec:java -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=com.oceanbase.samples.OceanBaseClientTest 4 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | import { Environment } from '@delon/theme'; 2 | 3 | export const environment = { 4 | production: true, 5 | useHash: false, 6 | api: { 7 | baseUrl: '/api/', 8 | refreshTokenEnabled: true 9 | } 10 | } as Environment; 11 | -------------------------------------------------------------------------------- /applications/sveltekit/src/components/Navbar.svelte: -------------------------------------------------------------------------------- 1 | 3 | 4 |
5 |
8 | OceanBase + SvelteKit demo 9 |
10 |
11 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/style-icons.ts: -------------------------------------------------------------------------------- 1 | // Custom icon static resources 2 | 3 | import { BulbOutline, ExceptionOutline, InfoOutline, LinkOutline, ProfileOutline } from '@ant-design/icons-angular/icons'; 4 | 5 | export const ICONS = [InfoOutline, BulbOutline, ProfileOutline, ExceptionOutline, LinkOutline]; 6 | -------------------------------------------------------------------------------- /javascript/drizzle/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | import "dotenv/config"; 2 | import { defineConfig } from "drizzle-kit"; 3 | 4 | export default defineConfig({ 5 | out: "./drizzle", 6 | schema: "./db/schema.ts", 7 | dialect: "mysql", 8 | dbCredentials: { 9 | url: process.env.DATABASE_URL!, 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/PersonMapper.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.mybatisplus; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface PersonMapper extends BaseMapper { 8 | } 9 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.prettierignore: -------------------------------------------------------------------------------- 1 | # add files you wish to ignore here 2 | **/*.md 3 | **/*.svg 4 | **/test.ts 5 | 6 | .stylelintrc 7 | .prettierrc 8 | 9 | src/assets/* 10 | src/index.html 11 | node_modules/ 12 | .vscode/ 13 | coverage/ 14 | dist/ 15 | package.json 16 | tslint.json 17 | 18 | _cli-tpl/**/* 19 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/layout/blank/blank.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'layout-blank', 5 | template: ` `, 6 | host: { 7 | '[class.alain-blank]': 'true' 8 | } 9 | }) 10 | export class LayoutBlankComponent {} 11 | -------------------------------------------------------------------------------- /javascript/drizzle/db/schema.ts: -------------------------------------------------------------------------------- 1 | import { mysqlTable, bigint, varchar } from "drizzle-orm/mysql-core"; 2 | 3 | export const usersTable = mysqlTable("users", { 4 | id: bigint({ mode: "bigint" }).autoincrement().primaryKey(), 5 | email: varchar({ length: 255 }).notNull().unique(), 6 | name: varchar({ length: 255 }).notNull(), 7 | }); 8 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/components/key-value-input/key-value-input.component.less: -------------------------------------------------------------------------------- 1 | .dynamic-button { 2 | position: relative; 3 | top: 20%; 4 | margin-left: 12%; 5 | font-size: 15px; 6 | cursor: pointer; 7 | transition: all 0.3s; 8 | } 9 | 10 | .dynamic-button:hover { 11 | font-size: 26px; 12 | } 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.java] 12 | indent_size = 4 13 | 14 | [*.go] 15 | indent_style = tab 16 | indent_size = 4 17 | 18 | [*.py] 19 | indent_size = 4 20 | -------------------------------------------------------------------------------- /golang/gorm/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/oceanbase/ob-samples/gorm 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/go-sql-driver/mysql v1.7.0 7 | gorm.io/driver/mysql v1.5.6 8 | gorm.io/gorm v1.25.10 9 | ) 10 | 11 | require ( 12 | github.com/jinzhu/inflection v1.0.0 // indirect 13 | github.com/jinzhu/now v1.1.5 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/components/metrics-field-input/metrics-field-input.component.less: -------------------------------------------------------------------------------- 1 | .dynamic-button { 2 | position: relative; 3 | top: 20%; 4 | margin-left: 12%; 5 | font-size: 15px; 6 | cursor: pointer; 7 | transition: all 0.3s; 8 | } 9 | 10 | .dynamic-button:hover { 11 | font-size: 26px; 12 | } 13 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/core/module-import-guard.ts: -------------------------------------------------------------------------------- 1 | // https://angular.io/guide/styleguide#style-04-12 2 | export function throwIfAlreadyLoaded(parentModule: any, moduleName: string): void { 3 | if (parentModule) { 4 | throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ruby/sequel/example.rb: -------------------------------------------------------------------------------- 1 | require 'sequel' 2 | 3 | # 连接到OceanBase数据库 4 | DB = Sequel.connect( 5 | adapter: 'mysql2', 6 | host: '127.0.0.1', 7 | port: 2881, 8 | user: 'root', 9 | password: '', 10 | database: 'test' 11 | ) 12 | 13 | if DB.test_connection 14 | puts "成功连接到OceanBase数据库" 15 | else 16 | puts "连接到OceanBase数据库失败" 17 | end 18 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | useTabs: false, 4 | printWidth: 140, 5 | tabWidth: 2, 6 | semi: true, 7 | htmlWhitespaceSensitivity: 'strict', 8 | arrowParens: 'avoid', 9 | bracketSpacing: true, 10 | proseWrap: 'preserve', 11 | trailingComma: 'none', 12 | endOfLine: 'lf' 13 | }; 14 | -------------------------------------------------------------------------------- /java/spring-jdbc/src/test/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS test; 2 | USE test; 3 | 4 | CREATE TABLE IF NOT EXISTS staff 5 | ( 6 | id INT AUTO_INCREMENT PRIMARY KEY, 7 | name VARCHAR(50) 8 | ); 9 | 10 | INSERT INTO staff (name) VALUES ('Bruce'); 11 | INSERT INTO staff (name) VALUES ('Jack'); 12 | INSERT INTO staff (name) VALUES ('Tom'); 13 | -------------------------------------------------------------------------------- /java/springboot/src/main/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS test; 2 | USE test; 3 | DROP TABLE IF EXISTS staff; 4 | CREATE TABLE staff 5 | ( 6 | id INT AUTO_INCREMENT PRIMARY KEY, 7 | name VARCHAR(255) NULL 8 | ); 9 | 10 | INSERT INTO staff (name) VALUES ('Alice'); 11 | INSERT INTO staff (name) VALUES ('Bob'); 12 | INSERT INTO staff (name) VALUES ('test'); 13 | -------------------------------------------------------------------------------- /java/testcontainers-java/src/test/resources/log4j2-test.properties: -------------------------------------------------------------------------------- 1 | rootLogger.level=INFO 2 | rootLogger.appenderRef.test.ref = TestLogger 3 | 4 | appender.testlogger.name = TestLogger 5 | appender.testlogger.type = CONSOLE 6 | appender.testlogger.target = SYSTEM_ERR 7 | appender.testlogger.layout.type = PatternLayout 8 | appender.testlogger.layout.pattern = %-4r [%t] %-5p %c - %m%n 9 | -------------------------------------------------------------------------------- /java/mybatis/src/test/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS test; 2 | USE test; 3 | DROP TABLE IF EXISTS user; 4 | CREATE TABLE user 5 | ( 6 | id INT AUTO_INCREMENT PRIMARY KEY, 7 | name VARCHAR(50) 8 | ); 9 | 10 | INSERT INTO user (name) 11 | VALUES ('Bruce'); 12 | INSERT INTO user (name) 13 | VALUES ('Jack'); 14 | INSERT INTO user (name) 15 | VALUES ('Tom'); 16 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /javascript/drizzle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2016", 4 | "experimentalDecorators": true, 5 | "emitDecoratorMetadata": true, 6 | "module": "commonjs", 7 | "esModuleInterop": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "strict": true, 10 | "strictPropertyInitialization": false, 11 | "skipLibCheck": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /javascript/typeorm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2016", 4 | "experimentalDecorators": true, 5 | "emitDecoratorMetadata": true, 6 | "module": "commonjs", 7 | "esModuleInterop": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "strict": true, 10 | "strictPropertyInitialization": false, 11 | "skipLibCheck": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /python/sqlalchemy/demo/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | # 3 | # Date : 2024-05-29 14:28 4 | # Desc : 运行入口 5 | from db.base import get_db 6 | from db.curd import insert_user, query_all_user 7 | 8 | 9 | if __name__ == '__main__': 10 | with get_db() as db: 11 | # 新增用户 12 | insert_user(db, 'HelloGitHub', 8) 13 | # 查询所有用户 14 | query_all_user(db) 15 | -------------------------------------------------------------------------------- /javascript/sequelize/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sequelize", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "mysql2": "^3.11.3", 14 | "sequelize": "^6.37.5" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/backend/LICENSE-reactive-streams.txt: -------------------------------------------------------------------------------- 1 | Licensed under Public Domain (CC0) 2 | 3 | To the extent possible under law, the person who associated CC0 with 4 | this code has waived all copyright and related or neighboring 5 | rights to this code. 6 | 7 | You should have received a copy of the CC0 legalcode along with this 8 | work. If not, see . -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/shared-delon.module.ts: -------------------------------------------------------------------------------- 1 | import { PageHeaderModule } from '@delon/abc/page-header'; 2 | import { ResultModule } from '@delon/abc/result'; 3 | import { SEModule } from '@delon/abc/se'; 4 | import { STModule } from '@delon/abc/st'; 5 | import { SVModule } from '@delon/abc/sv'; 6 | 7 | export const SHARED_DELON_MODULES = [PageHeaderModule, STModule, SEModule, SVModule, ResultModule]; 8 | -------------------------------------------------------------------------------- /java/mybatis-plus/src/test/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS test; 2 | USE test; 3 | 4 | CREATE TABLE IF NOT EXISTS person 5 | ( 6 | id INT AUTO_INCREMENT PRIMARY KEY, 7 | name VARCHAR(50), 8 | age INT 9 | ); 10 | 11 | INSERT INTO person (name, age) 12 | VALUES ('Alice', 30); 13 | INSERT INTO person (name, age) 14 | VALUES ('Bob', 25); 15 | INSERT INTO person (name, age) 16 | VALUES ('Charlie', 35); 17 | -------------------------------------------------------------------------------- /applications/sveltekit/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/passport/lock/lock.component.less: -------------------------------------------------------------------------------- 1 | :host ::ng-deep { 2 | .ant-card-body { 3 | position: relative; 4 | margin-top: 80px; 5 | } 6 | .avatar { 7 | position: absolute; 8 | top: -20px; 9 | left: 50%; 10 | margin-left: -20px; 11 | } 12 | } 13 | 14 | [data-theme='dark'] { 15 | :host ::ng-deep { 16 | .ant-card { 17 | background-color: black; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /applications/sveltekit/src/styles/tailwind-output.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhaWx3aW5kLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjO0FBQ2Qsb0JBQW9CO0FBQ3BCLG1CQUFtQiIsImZpbGUiOiJ0YWlsd2luZC1vdXRwdXQuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiQHRhaWx3aW5kIGJhc2U7XG5AdGFpbHdpbmQgY29tcG9uZW50cztcbkB0YWlsd2luZCB1dGlsaXRpZXM7XG4iXX0= */ -------------------------------------------------------------------------------- /applications/hertzbeat/collector/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | _ _ _ ____ _ 2 | | | | | ___ _ __| |_ ___| __ ) ___ __ _| |_ 3 | | |_| |/ _ \ '__| __|_ / _ \ / _ \/ _` | __| Profile: ${spring.profiles.active} 4 | | _ | __/ | | |_ / /| |_) | __/ (_| | |_ Name: ${spring.application.name} Port: ${server.port} Pid: ${pid} 5 | |_| |_|\___|_| \__/___|____/ \___|\__,_|\__| https://hertzbeat.apache.org/ 6 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | _ _ _ ____ _ 2 | | | | | ___ _ __| |_ ___| __ ) ___ __ _| |_ 3 | | |_| |/ _ \ '__| __|_ / _ \ / _ \/ _` | __| Profile: ${spring.profiles.active} 4 | | _ | __/ | | |_ / /| |_) | __/ (_| | |_ Name: ${spring.application.name} Port: ${server.port} Pid: ${pid} 5 | |_| |_|\___|_| \__/___|____/ \___|\__,_|\__| https://hertzbeat.apache.org/ 6 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /java/springboot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | jpa: 3 | hibernate: 4 | ddl-auto: create-drop 5 | database: mysql # mysql, oracle 6 | show-sql: true 7 | datasource: 8 | driver-class-name: com.mysql.cj.jdbc.Driver 9 | url: jdbc:mysql://localhost:2881/?characterEncoding=UTF-8 10 | username: root@test 11 | password: 12 | sql: 13 | init: 14 | mode: always 15 | data-locations: classpath:/init.sql 16 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/6-FlyBookRobotTemplate.txt: -------------------------------------------------------------------------------- 1 | ${targetLabel} : ${target} 2 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 3 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 4 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 5 | ${priorityLabel} : ${priority} 6 | ${triggerTimeLabel} : ${triggerTime} 7 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 8 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/9-DiscordBotTemplate.txt: -------------------------------------------------------------------------------- 1 | ${targetLabel} : ${target} 2 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 3 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 4 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 5 | ${priorityLabel} : ${priority} 6 | ${triggerTimeLabel} : ${triggerTime} 7 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 8 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/core/core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Optional, SkipSelf } from '@angular/core'; 2 | 3 | import { I18NService } from './i18n/i18n.service'; 4 | import { throwIfAlreadyLoaded } from './module-import-guard'; 5 | 6 | @NgModule({ 7 | providers: [I18NService] 8 | }) 9 | export class CoreModule { 10 | constructor(@Optional() @SkipSelf() parentModule: CoreModule) { 11 | throwIfAlreadyLoaded(parentModule, 'CoreModule'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/monitor/monitor-data-table/monitor-data-table.component.less: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: xx-small; 3 | word-wrap: break-word; 4 | word-break: break-all; 5 | } 6 | 7 | // angular 修改第三方子组件样式 8 | // :host 表示选择当前的组件## 9 | // ::ng-deep 可以忽略中间className的嵌套层级关系。直接找到你要修改的className## 10 | :host ::ng-deep { 11 | .ant-card-head { 12 | padding: 0 4px 0 4px; 13 | } 14 | .ant-card-head-title { 15 | padding: 16px 0 4px 0; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/8-SlackTemplate.txt: -------------------------------------------------------------------------------- 1 | *[${title}]* 2 | ${targetLabel} : ${target} 3 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 4 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 5 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 6 | ${priorityLabel} : ${priority} 7 | ${triggerTimeLabel} : ${triggerTime} 8 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 9 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/sveltekit/src/routes/+page.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 |

9 | Todo App 10 |

11 | 12 | {#each $todos as todo (todo.id)} 13 | 14 | {/each} 15 |
16 | -------------------------------------------------------------------------------- /java/springboot/src/main/java/com/oceanbase/samples/springboot/SpringBootJavaApplication.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootJavaApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(SpringBootJavaApplication.class, args); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/10-WeWorkAppTemplate.txt: -------------------------------------------------------------------------------- 1 | [${title}] 2 | ${targetLabel} : ${target} 3 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 4 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 5 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 6 | ${priorityLabel} : ${priority} 7 | ${triggerTimeLabel} : ${triggerTime} 8 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 9 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/4-WeWorkRobotTemplate.txt: -------------------------------------------------------------------------------- 1 | [${title}] 2 | ${targetLabel} : ${target} 3 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 4 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 5 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 6 | ${priorityLabel} : ${priority} 7 | ${triggerTimeLabel} : ${triggerTime} 8 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 9 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/7-TelegramBotTemplate.txt: -------------------------------------------------------------------------------- 1 | [${title}] 2 | ${targetLabel} : ${target} 3 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 4 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 5 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 6 | ${priorityLabel} : ${priority} 7 | ${triggerTimeLabel} : ${triggerTime} 8 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 9 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/mydata/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | 8 | "mydata/internal/version" 9 | ) 10 | 11 | var versionCmd = &cobra.Command{ 12 | Use: "version", 13 | Short: "Print the version number of tool", 14 | Long: "Print the version number of tool", 15 | Run: func(cmd *cobra.Command, args []string) { 16 | fmt.Println(version.GetRawInfo()) 17 | }, 18 | } 19 | 20 | func init() { 21 | rootCmd.AddCommand(versionCmd) 22 | } 23 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/11-HuaweiCloudSmnTemplate.txt: -------------------------------------------------------------------------------- 1 | [${title}] 2 | ${targetLabel} : ${target} 3 | <#if (monitorId??)>${monitorIdLabel} : ${monitorId} 4 | <#if (monitorName??)>${monitorNameLabel} : ${monitorName} 5 | <#if (monitorHost??)>${monitorHostLabel} : ${monitorHost} 6 | ${priorityLabel} : ${priority} 7 | ${triggerTimeLabel} : ${triggerTime} 8 | <#if (restoreTimeLabel??)>${restoreTimeLabel} : ${restoreTime} 9 | ${contentLabel} : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/script/helm/hertzbeat/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplication.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.mybatisplus; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MybatisPlusJavaApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MybatisPlusJavaApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /applications/sveltekit/src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 | {#if $user} 11 | 12 | 13 | {:else} 14 | 15 | {/if} 16 |
17 | -------------------------------------------------------------------------------- /applications/sveltekit/src/lib/db.js: -------------------------------------------------------------------------------- 1 | export function createOceanbaseConnection() { 2 | return new Promise((resolve, reject) => { 3 | const mysql = require('mysql2'); 4 | const connection = mysql.createConnection({ 5 | host: '127.0.0.1', 6 | user: 'root@test', 7 | port: '2881', 8 | password: '', 9 | database: 'test', 10 | }); 11 | connection.connect((err) => { 12 | if (err) { 13 | reject(err); 14 | } 15 | resolve(connection); 16 | }); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /javascript/prisma/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prisma", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "devDependencies": { 13 | "@types/node": "^22.8.4", 14 | "prisma": "^5.21.1", 15 | "ts-node": "^10.9.2", 16 | "typescript": "^5.6.3" 17 | }, 18 | "dependencies": { 19 | "@prisma/client": "^5.21.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /applications/mydata/internal/dbinfo/keyrange_test.go: -------------------------------------------------------------------------------- 1 | package dbinfo 2 | 3 | import ( 4 | "log" 5 | "testing" 6 | ) 7 | 8 | func TestGetChunkQuery(t *testing.T) { 9 | dbc := DbConf{Addr: "192.168.111.3:3306", Username: "root", Password: "root", Dbname: "testdb"} 10 | for _, v := range []int{2, 3, 4, 5, 10} { 11 | query, err := GetChunkQuery(dbc, "select * from t1", v) 12 | if err != nil { 13 | t.Fatal(err) 14 | } 15 | for ii, vv := range query { 16 | log.Printf(">>>v:%d, %d, sql:%s", v, ii, vv) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-ping.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "ping", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorPing}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "timeout", 19 | "type": 0, 20 | "value": 6000 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.eslintignore: -------------------------------------------------------------------------------- 1 | _cli-tpl/ 2 | dist/ 3 | coverage/ 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Dependency directories 13 | node_modules/ 14 | 15 | # TypeScript cache 16 | *.tsbuildinfo 17 | 18 | # Optional npm cache directory 19 | .npm 20 | 21 | # Optional eslint cache 22 | .eslintcache 23 | 24 | # Yarn Integrity file 25 | .yarn-integrity 26 | 27 | # dotenv environment variables file 28 | .env 29 | .env.test 30 | 31 | .cache/ 32 | 33 | # yarn v2 34 | .yarn 35 | -------------------------------------------------------------------------------- /javascript/typeorm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typeorm", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "mysql2": "^3.11.3", 14 | "reflect-metadata": "^0.2.2", 15 | "typeorm": "^0.3.20" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^22.8.5", 19 | "ts-node": "^10.9.2", 20 | "typescript": "^5.6.3" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/icons-provider.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { MenuFoldOutline, MenuUnfoldOutline, FormOutline, DashboardOutline } from '@ant-design/icons-angular/icons'; 3 | import { NZ_ICONS, NzIconModule } from 'ng-zorro-antd/icon'; 4 | 5 | const icons = [MenuFoldOutline, MenuUnfoldOutline, DashboardOutline, FormOutline]; 6 | 7 | @NgModule({ 8 | imports: [NzIconModule], 9 | exports: [NzIconModule], 10 | providers: [{ provide: NZ_ICONS, useValue: icons }] 11 | }) 12 | export class IconsProviderModule {} 13 | -------------------------------------------------------------------------------- /applications/sveltekit/svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from '@sveltejs/adapter-auto'; 2 | 3 | /** @type {import('@sveltejs/kit').Config} */ 4 | const config = { 5 | kit: { 6 | // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. 7 | // If your environment is not supported, or you settled on a specific environment, switch out the adapter. 8 | // See https://kit.svelte.dev/docs/adapters for more information about adapters. 9 | adapter: adapter(), 10 | }, 11 | }; 12 | 13 | export default config; 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/13-GotifyTemplate.txt: -------------------------------------------------------------------------------- 1 | #### [${title}] 2 | ##### **${targetLabel}** : ${target} 3 | <#if (monitorId??)>##### **${monitorIdLabel}** : ${monitorId} 4 | <#if (monitorName??)>##### **${monitorNameLabel}** : ${monitorName} 5 | <#if (monitorHost??)>##### **${monitorHostLabel}** : ${monitorHost} 6 | ##### **${priorityLabel}** : ${priority} 7 | ##### **${triggerTimeLabel}** : ${triggerTime} 8 | <#if (restoreTimeLabel??)>##### **${restoreTimeLabel}** : ${restoreTime} 9 | ##### **${contentLabel}** : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/12-ServerChanTemplate.txt: -------------------------------------------------------------------------------- 1 | #### [${title}] 2 | ##### **${targetLabel}** : ${target} 3 | <#if (monitorId??)>##### **${monitorIdLabel}** : ${monitorId} 4 | <#if (monitorName??)>##### **${monitorNameLabel}** : ${monitorName} 5 | <#if (monitorHost??)>##### **${monitorHostLabel}** : ${monitorHost} 6 | ##### **${priorityLabel}** : ${priority} 7 | ##### **${triggerTimeLabel}** : ${triggerTime} 8 | <#if (restoreTimeLabel??)>##### **${restoreTimeLabel}** : ${restoreTime} 9 | ##### **${contentLabel}** : ${content} -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/5-DingTalkRobotTemplate.txt: -------------------------------------------------------------------------------- 1 | #### [${title}] 2 | ##### **${targetLabel}** : ${target} 3 | <#if (monitorId??)>##### **${monitorIdLabel}** : ${monitorId} 4 | <#if (monitorName??)>##### **${monitorNameLabel}** : ${monitorName} 5 | <#if (monitorHost??)>##### **${monitorHostLabel}** : ${monitorHost} 6 | ##### **${priorityLabel}** : ${priority} 7 | ##### **${triggerTimeLabel}** : ${triggerTime} 8 | <#if (restoreTimeLabel??)>##### **${restoreTimeLabel}** : ${restoreTime} 9 | ##### **${contentLabel}** : ${content} -------------------------------------------------------------------------------- /python/sqlalchemy/demo/db/curd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # 4 | # Date : 2024-05-29 14:28 5 | # Desc : 操作表的数据 6 | from sqlalchemy.orm import Session 7 | 8 | from db.models import User 9 | 10 | 11 | def insert_user(db: Session, name: str, age: int): 12 | # 新增用户数据 13 | user = User(name=name, age=age) 14 | db.add(user) 15 | # 提交事务, 保存数据。get_db 中做了所以这里不需要再提交 16 | db.commit() 17 | 18 | 19 | def query_all_user(db: Session): 20 | users = db.query(User).all() 21 | for user in users: 22 | print(user) 23 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/README.md: -------------------------------------------------------------------------------- 1 | ## Docker-Compose Deploy 2 | 3 | - Use Mysql + VictoriaMetrics as Hertzbeat dependent storage -> [HertzBeat+Mysql+VictoriaMetrics Solution](hertzbeat-mysql-victoria-metrics) 4 | - Use Mysql + IoTDB as Hertzbeat dependent storage -> [HertzBeat+Mysql+IoTDB Solution](hertzbeat-mysql-iotdb) 5 | - Use Mysql + Tdengine as Hertzbeat dependent storage -> [HertzBeat+Mysql+Tdengine Solution](hertzbeat-mysql-tdengine) 6 | - Use Postgresql + IoTDB as Hertzbeat dependent storage -> [HertzBeat+PostgreSQL+IoTDB Solution](hertzbeat-postgresql-iotdb) 7 | -------------------------------------------------------------------------------- /javascript/drizzle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drizzle", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "dotenv": "^16.4.5", 14 | "drizzle-orm": "^0.36.0", 15 | "mysql2": "^3.11.3" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^22.8.5", 19 | "drizzle-kit": "^0.27.0", 20 | "ts-node": "^10.9.2", 21 | "typescript": "^5.6.3" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /applications/mydata/internal/transfor/transfor.go: -------------------------------------------------------------------------------- 1 | package transfor 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | "golang.org/x/text/encoding/simplifiedchinese" 6 | ) 7 | 8 | func ConvStr2GBK(b []byte) ([]byte, error) { 9 | bs, err := simplifiedchinese.GBK.NewEncoder().Bytes(b) 10 | if err != nil { 11 | return nil, errors.WithStack(err) 12 | } 13 | return bs, nil 14 | } 15 | 16 | func ConvGBK2Str(gb []byte) ([]byte, error) { 17 | bs, err := simplifiedchinese.GBK.NewDecoder().Bytes(gb) 18 | if err != nil { 19 | return nil, errors.WithStack(err) 20 | } 21 | 22 | return bs, nil 23 | } 24 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/test.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-unassigned-import */ 2 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 3 | 4 | import 'zone.js/testing'; 5 | import { getTestBed } from '@angular/core/testing'; 6 | import { 7 | BrowserDynamicTestingModule, 8 | platformBrowserDynamicTesting 9 | } from '@angular/platform-browser-dynamic/testing'; 10 | 11 | // First, initialize the Angular testing environment. 12 | getTestBed().initTestEnvironment( 13 | BrowserDynamicTestingModule, 14 | platformBrowserDynamicTesting() 15 | ); 16 | -------------------------------------------------------------------------------- /applications/hertzbeat/DISCLAIMER: -------------------------------------------------------------------------------- 1 | Apache HertzBeat (incubating) is an effort undergoing incubation at the Apache 2 | Software Foundation (ASF), sponsored by the Apache Incubator PMC. 3 | 4 | Incubation is required of all newly accepted projects until a further review 5 | indicates that the infrastructure, communications, and decision making process 6 | have stabilized in a manner consistent with other successful ASF projects. 7 | 8 | While incubation status is not necessarily a reflection of the completeness 9 | or stability of the code, it does indicate that the project has yet to be 10 | fully endorsed by the ASF. 11 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-ssl.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "ssl_cert", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorSSL}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 443 21 | }, 22 | { 23 | "field": "uri", 24 | "type": 1 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /applications/mydata/internal/transfor/transfor_test.go: -------------------------------------------------------------------------------- 1 | package transfor 2 | 3 | import ( 4 | "bytes" 5 | "log" 6 | "testing" 7 | ) 8 | 9 | func TestConvGBK2Str(t *testing.T) { 10 | srcByte := []byte("中国人") 11 | gbkByte, err := ConvStr2GBK(srcByte) 12 | if err != nil { 13 | t.Error(err) 14 | } 15 | log.Printf(">>>%x", gbkByte) 16 | 17 | utf8Byte, err := ConvGBK2Str(gbkByte) 18 | if err != nil { 19 | t.Error(err) 20 | } 21 | 22 | if bytes.Compare(srcByte, utf8Byte) != 0 { 23 | log.Printf("srcByte:%X, utf8Byte:%X", srcByte, utf8Byte) 24 | } 25 | 26 | log.Printf("srcByte:%X, utf8Byte:%X", srcByte, utf8Byte) 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/cpp.yml: -------------------------------------------------------------------------------- 1 | name: C++ CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/cpp.yml' 7 | - 'c_cplusplus/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/cpp.yml' 11 | - 'c_cplusplus/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'mysql-connector-cpp' 19 | with_oceanbase_container: true 20 | uses: ./.github/workflows/basic-workflow.yml 21 | with: 22 | language: 'cpp' 23 | module: ${{ matrix.module.name }} 24 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-port.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "port", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorPort}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 80 21 | }, 22 | { 23 | "field": "timeout", 24 | "type": 0, 25 | "value": 6000 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /javascript/drizzle/index.ts: -------------------------------------------------------------------------------- 1 | import "dotenv/config"; 2 | import { drizzle } from "drizzle-orm/mysql2"; 3 | import { usersTable } from "./db/schema"; 4 | 5 | const db = drizzle(process.env.DATABASE_URL!); 6 | 7 | async function main() { 8 | const user: typeof usersTable.$inferInsert = { 9 | name: "Alice", 10 | email: "alice@oceanbase.com", 11 | }; 12 | await db.insert(usersTable).values(user); 13 | 14 | const allUsers = await db.select().from(usersTable); 15 | console.log(allUsers); 16 | } 17 | 18 | main() 19 | .then(() => { 20 | process.exit(0); 21 | }) 22 | .catch((err) => { 23 | console.log(err); 24 | }); 25 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/monitor/monitor-detail/monitor-detail.component.less: -------------------------------------------------------------------------------- 1 | nz-sider { 2 | height: 100%; 3 | margin-right: 15px; 4 | line-height: 120px; 5 | } 6 | 7 | nz-content { 8 | min-height: 100%; 9 | line-height: 120px; 10 | } 11 | 12 | nz-layout { 13 | height: 100%; 14 | margin-bottom: 10px; 15 | } 16 | 17 | nz-layout:last-child { 18 | margin: 0; 19 | } 20 | 21 | p { 22 | font-size: xx-small; 23 | word-wrap: break-word; 24 | word-break: break-all; 25 | } 26 | 27 | [data-theme='dark'] { 28 | :host ::ng-deep { 29 | .ant-layout-sider-light { 30 | background: #141414; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/exception/exception.component.ts: -------------------------------------------------------------------------------- 1 | import { ChangeDetectionStrategy, Component } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { ExceptionType } from '@delon/abc/exception'; 4 | 5 | @Component({ 6 | selector: 'app-exception', 7 | template: ` `, 8 | changeDetection: ChangeDetectionStrategy.OnPush 9 | }) 10 | export class ExceptionComponent { 11 | get type(): ExceptionType { 12 | return this.route.snapshot.data.type; 13 | } 14 | 15 | constructor(private route: ActivatedRoute) {} 16 | } 17 | -------------------------------------------------------------------------------- /java/springboot/src/main/java/com/oceanbase/samples/springboot/repository/StaffEntityRepository.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.springboot.repository; 2 | 3 | import com.oceanbase.samples.springboot.entity.StaffEntity; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface StaffEntityRepository extends CrudRepository { 11 | List findByTestName(String lastName); 12 | 13 | List findByTestNameContaining(String testName); 14 | 15 | StaffEntity findById(int id); 16 | } 17 | -------------------------------------------------------------------------------- /python/sqlalchemy/demo/db/models.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # 4 | # Date : 2024-05-29 14:28 5 | # Desc : 配置文件 6 | from sqlalchemy import Column, Integer, VARCHAR 7 | 8 | from db.base import Base, engine 9 | 10 | 11 | # 定义一个 ORM 模型,映射到数据库中的表 12 | class User(Base): 13 | __tablename__ = 'users' 14 | 15 | id = Column(Integer, primary_key=True) 16 | name = Column(VARCHAR(50)) 17 | age = Column(Integer) 18 | 19 | def __repr__(self): 20 | return f"" 21 | 22 | 23 | if __name__ == '__main__': 24 | # 创建数据库表(如果表不存在) 25 | Base.metadata.create_all(engine) 26 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/README.md: -------------------------------------------------------------------------------- 1 | Please add the corresponding e2e (aka end-to-end) test cases if you add or update APIs. 2 | 3 | ## How to work 4 | * Start and watch the [docker-compose](https://docs.docker.com/compose/) via [the script](start.sh) 5 | * Run the e2e testing via [api-testing](https://github.com/LinuxSuRen/api-testing) 6 | * It will run the test cases from top to bottom 7 | * You can add the necessary asserts to it 8 | 9 | ## Run locally 10 | Please follow these steps if you want to run the e2e testing locally. 11 | 12 | > Please make sure you have installed docker-compose v2 13 | 14 | * Change the directory to `e2e`, then execute `./start.sh` 15 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/exception/exception-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | import { ExceptionComponent } from './exception.component'; 5 | 6 | const routes: Routes = [ 7 | { path: '403', component: ExceptionComponent, data: { type: 403 } }, 8 | { path: '404', component: ExceptionComponent, data: { type: 404 } }, 9 | { path: '500', component: ExceptionComponent, data: { type: 500 } } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class ExceptionRoutingModule {} 17 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/resources/templates/2-WebhookTemplate.txt: -------------------------------------------------------------------------------- 1 | { 2 | "target": "${target}", 3 | <#if alarmId??>"alarmId": ${alarmId}, 4 | <#if thresholdId??>"thresholdId": "${thresholdId}", 5 | <#if priorityValue??>"priority": ${priorityValue}, 6 | "content": "${content}", 7 | <#if status??>"status": ${status}, 8 | <#if times??>"times": ${times}, 9 | "triggerTime": "${triggerTime}", 10 | <#if restoreTime??>"restoreTime": "${restoreTime}", 11 | <#if tags??> 12 | "tags": { 13 | <#list tags as key,value> 14 | "${key}": "${value}"<#if key_has_next>, 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /python/sqlalchemy/demo/db/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # 4 | # Date : 2024-05-29 14:28 5 | # Desc : 配置文件 6 | 7 | 8 | class Config(object): 9 | 10 | @staticmethod 11 | def oceanbase_db_url(): 12 | # OceanBase 数据库连接参数 13 | username = 'root' 14 | password = '' 15 | host = 'localhost' 16 | port = '2881' 17 | database = 'test' 18 | db_url = 'mysql+pymysql://{username}:{password}@{host}:{port}/{database}'.format( 19 | username=username, password=password, host=host, port=port, database=database) 20 | return db_url 21 | 22 | 23 | ob_db_url = Config.oceanbase_db_url() 24 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/json-schema/json-schema.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { DelonFormModule, WidgetRegistry } from '@delon/form'; 3 | 4 | import { SharedModule } from '../shared.module'; 5 | import { TestWidget } from './test/test.widget'; 6 | 7 | export const SCHEMA_THIRDS_COMPONENTS = [TestWidget]; 8 | 9 | @NgModule({ 10 | declarations: SCHEMA_THIRDS_COMPONENTS, 11 | imports: [SharedModule, DelonFormModule.forRoot()], 12 | exports: SCHEMA_THIRDS_COMPONENTS 13 | }) 14 | export class JsonSchemaModule { 15 | constructor(widgetRegistry: WidgetRegistry) { 16 | widgetRegistry.register(TestWidget.KEY, TestWidget); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/exception/exception.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { ExceptionModule as DelonExceptionModule } from '@delon/abc/exception'; 4 | import { NzButtonModule } from 'ng-zorro-antd/button'; 5 | import { NzCardModule } from 'ng-zorro-antd/card'; 6 | 7 | import { ExceptionRoutingModule } from './exception-routing.module'; 8 | import { ExceptionComponent } from './exception.component'; 9 | 10 | @NgModule({ 11 | imports: [CommonModule, DelonExceptionModule, NzButtonModule, NzCardModule, ExceptionRoutingModule], 12 | declarations: [ExceptionComponent] 13 | }) 14 | export class ExceptionModule {} 15 | -------------------------------------------------------------------------------- /golang/gorm/README-CN.md: -------------------------------------------------------------------------------- 1 | # Golang 连接 OceanBase 指南(使用 gorm.io/driver/mysql) 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过 `gorm.io/driver/mysql` 连接 OceanBase 数据库。 6 | 7 | 关于 `gorm.io/driver/mysql` 的详细信息,您可参考 [gorm.io/driver/mysql](https://gorm.io/driver/mysql)。 8 | 9 | ## 快速开始 10 | 11 | 您需要使用代码中的 `conf` 来创建数据库连接,详细信息请参考 [gorm.io/docs/](https://gorm.io/docs)。 12 | 13 | 以 [example.go](example.go) 代码为例 14 | 15 | 16 | 修改run.sh代码中的连接信息, 如`host, port, username, password, database`,之后你就可以直接使用 run.sh 运行示例代码。 17 | 18 | ```bash 19 | sh run.sh 20 | ``` 21 | 22 | ### 使用 PreparedStatement 23 | 24 | 使用 root 用户登录 OceanBase,运行如下命令: 25 | 26 | ```bash 27 | alter system set _ob_enable_prepared_statement = true; 28 | ``` 29 | -------------------------------------------------------------------------------- /.github/workflows/golang.yml: -------------------------------------------------------------------------------- 1 | name: Golang CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/golang.yml' 7 | - 'golang/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/golang.yml' 11 | - 'golang/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'go-sql-driver' 19 | with_oceanbase_container: true 20 | - name: 'gorm' 21 | with_oceanbase_container: true 22 | uses: ./.github/workflows/basic-workflow.yml 23 | with: 24 | language: 'golang' 25 | module: ${{ matrix.module.name }} 26 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} 27 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-udp.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "udp_port", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorUDP}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 81 21 | }, 22 | { 23 | "field": "timeout", 24 | "type": 0, 25 | "value": 6000 26 | }, 27 | { 28 | "field": "content", 29 | "type": 1 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /javascript/mysql2/index.js: -------------------------------------------------------------------------------- 1 | const mysql = require('mysql2'); 2 | 3 | const connection = mysql.createConnection({ 4 | host: '127.0.0.1', // OceanBase服务器地址 5 | port: 2881, // OceanBase端口 6 | user: 'root', // 数据库用户名 7 | password: '', // 数据库密码 8 | database: 'test' // 数据库名称 9 | }); 10 | 11 | // 连接到数据库 12 | connection.connect(error => { 13 | if (error) { 14 | return console.error('连接到OceanBase数据库失败: ' + error.message); 15 | } 16 | 17 | console.log('成功连接到OceanBase数据库'); 18 | 19 | // 这里可以执行其他数据库操作 20 | 21 | // 关闭连接 22 | connection.end(err => { 23 | if (err) { 24 | return console.error('关闭数据库连接失败: ' + err.message); 25 | } 26 | console.log('关闭数据库连接成功'); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/json-schema/test/test.widget.ts: -------------------------------------------------------------------------------- 1 | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; 2 | import { ControlWidget } from '@delon/form'; 3 | 4 | @Component({ 5 | selector: 'test', 6 | template: ` 7 | 8 | test widget 9 | 10 | `, 11 | preserveWhitespaces: false, 12 | changeDetection: ChangeDetectionStrategy.OnPush 13 | }) 14 | export class TestWidget extends ControlWidget implements OnInit { 15 | static readonly KEY = 'test'; 16 | 17 | ngOnInit(): void { 18 | console.warn('init test widget'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ruby/activerecord/example.rb: -------------------------------------------------------------------------------- 1 | require 'active_record' 2 | 3 | # 数据库配置 4 | db_config = { 5 | adapter: 'mysql2', 6 | host: '127.0.0.1', 7 | port: 2881, 8 | username: 'root', 9 | password: '', 10 | database: 'test' 11 | } 12 | 13 | begin 14 | # 建立连接 15 | ActiveRecord::Base.establish_connection(db_config) 16 | 17 | # 测试连接是否成功 18 | connection = ActiveRecord::Base.connection 19 | result = connection.active? # 检查数据库连接是否有效 20 | 21 | if result 22 | puts "成功连接到OceanBase数据库" 23 | else 24 | puts "连接到OceanBase数据库失败" 25 | end 26 | 27 | rescue StandardError => e 28 | puts "连接到OceanBase数据库时发生错误: #{e.message}" 29 | ensure 30 | ActiveRecord::Base.connection.close if ActiveRecord::Base.connected? 31 | end 32 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-tslib.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation. 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted. 5 | 6 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 8 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 9 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 10 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 11 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 12 | PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "fullsite", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorSiteMap}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 80 21 | }, 22 | { 23 | "field": "sitemap", 24 | "type": 1, 25 | "value": "sitemap.xml" 26 | }, 27 | { 28 | "field": "ssl", 29 | "type": 1, 30 | "value": false 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /ruby/sequel/README-CN.md: -------------------------------------------------------------------------------- 1 | # Ruby连接 OceanBase 指南(sequel) 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过sequel连接 OceanBase 数据库。 6 | 7 | ## 快速开始 8 | 9 | 在开始之前,需要先确保 mysql2,sequel已安装。 10 | 11 | 安装命令 12 | 13 | ``` 14 | gem install sequel 15 | gem install mysql2 16 | ``` 17 | 18 | 以 [example.rb](example.rb) 为例。 19 | 20 | ``` 21 | require 'sequel' 22 | 23 | # 连接到OceanBase数据库 24 | DB = Sequel.connect( 25 | adapter: 'mysql2', 26 | host: '127.0.0.1', 27 | port: 2881, 28 | user: 'root', 29 | password: '', 30 | database: 'test' 31 | ) 32 | 33 | if DB.test_connection 34 | puts "成功连接到OceanBase数据库" 35 | else 36 | puts "连接到OceanBase数据库失败" 37 | end 38 | 39 | ``` 40 | 41 | 修改代码中的连接信息,之后你就可以直接使用命令行运行示例代码。 42 | 43 | ```bash 44 | sh run.sh 45 | ``` 46 | -------------------------------------------------------------------------------- /.github/workflows/ruby.yml: -------------------------------------------------------------------------------- 1 | name: Ruby CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/ruby.yml' 7 | - 'ruby/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/ruby.yml' 11 | - 'ruby/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'activerecord' 19 | with_oceanbase_container: true 20 | - name: 'mysql2' 21 | with_oceanbase_container: true 22 | - name: 'sequel' 23 | with_oceanbase_container: true 24 | uses: ./.github/workflows/basic-workflow.yml 25 | with: 26 | language: 'ruby' 27 | module: ${{ matrix.module.name }} 28 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} 29 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | # last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.github/workflows/python.yml: -------------------------------------------------------------------------------- 1 | name: Python CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/python.yml' 7 | - 'python/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/python.yml' 11 | - 'python/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'mysql-connector-python' 19 | with_oceanbase_container: true 20 | - name: 'pymysql' 21 | with_oceanbase_container: true 22 | - name: 'sqlalchemy' 23 | with_oceanbase_container: true 24 | uses: ./.github/workflows/basic-workflow.yml 25 | with: 26 | language: 'python' 27 | module: ${{ matrix.module.name }} 28 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} 29 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-internmap.txt: -------------------------------------------------------------------------------- 1 | Copyright 2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-array.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2023 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-color.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2022 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-dsv.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013-2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-path.txt: -------------------------------------------------------------------------------- 1 | Copyright 2015-2022 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-shape.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2022 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-timer.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /java/springboot/src/main/java/com/oceanbase/samples/springboot/entity/StaffEntity.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.springboot.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | import java.io.Serializable; 7 | 8 | /* 9 | * CREATE TABLE TEST(id integer, name varchar2(50)) 10 | * 11 | */ 12 | @Data 13 | @Entity 14 | @Table( name = "staff" ) 15 | public class StaffEntity implements Serializable { 16 | 17 | private static final long serialVersionUID = -6578740021873269176L; 18 | 19 | @Id 20 | @GeneratedValue(strategy=GenerationType.IDENTITY) 21 | // @GeneratedValue(strategy=GenerationType.AUTO) //oracle 没有自增策略,添加该注解可以自动生成一个序列,提供自增主键,若数据库已有相关序列,可以忽 //略该注解。 22 | @Column(name = "id") 23 | private Integer testId; 24 | 25 | @Column( name = "name" ) 26 | private String testName; 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | pom.xml.tag 6 | pom.xml.releaseBackup 7 | pom.xml.versionsBackup 8 | pom.xml.next 9 | release.properties 10 | 11 | ### IntelliJ IDEA ### 12 | .idea/ 13 | *.iml 14 | *.ipr 15 | *.iws 16 | 17 | ### Eclipse ### 18 | .apt_generated 19 | .classpath 20 | .factorypath 21 | .project 22 | .settings 23 | .springBeans 24 | .sts4-cache 25 | 26 | ### NetBeans ### 27 | /nbproject/private/ 28 | /nbbuild/ 29 | /dist/ 30 | /nbdist/ 31 | /.nb-gradle/ 32 | build/ 33 | !**/src/main/**/build/ 34 | !**/src/test/**/build/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | 39 | ### Mac OS ### 40 | .DS_Store 41 | 42 | ### Log ### 43 | *.log 44 | /logs 45 | 46 | ### JavaScript ### 47 | node_modules 48 | .svelte-kit 49 | 50 | ### Python ### 51 | __pycache__ 52 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-hierarchy.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-d3-interpolate.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-topojson-client.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012-2019 Michael Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /javascript/prisma/index.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client"; 2 | 3 | const prisma = new PrismaClient(); 4 | 5 | async function main() { 6 | await prisma.user.create({ 7 | data: { 8 | name: "Alice", 9 | email: "alice@oceanbase.com", 10 | posts: { 11 | create: { title: "Hello World" }, 12 | }, 13 | profile: { 14 | create: { bio: "I like turtles" }, 15 | }, 16 | }, 17 | }); 18 | 19 | const allUsers = await prisma.user.findMany({ 20 | include: { 21 | posts: true, 22 | profile: true, 23 | }, 24 | }); 25 | console.dir(allUsers, { depth: null }); 26 | } 27 | 28 | main() 29 | .then(async () => { 30 | await prisma.$disconnect(); 31 | }) 32 | .catch(async (e) => { 33 | console.error(e); 34 | await prisma.$disconnect(); 35 | process.exit(1); 36 | }); 37 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-simple-statistics.txt: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2014, Tom MacWright 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-inherits.txt: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) 2011-2023 Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | -------------------------------------------------------------------------------- /applications/sveltekit/src/routes/api/todos/+page.server.js: -------------------------------------------------------------------------------- 1 | import { createOceanbaseConnection } from '../../../lib/db'; 2 | 3 | export async function post() { 4 | let results = await createOceanbaseConnection() 5 | .query('SELECT * FROM tasks') 6 | .then(function ([rows, fields]) { 7 | console.log(rows); 8 | return rows; 9 | }); 10 | 11 | return { 12 | body: results, 13 | }; 14 | } 15 | export async function post(request) { 16 | console.log(request); 17 | const { text, completed } = request.body; 18 | let newTask = await createOceanbaseConnection() 19 | .query('INSERT INTO tasks (text, completed) VALUES (?, ?)', [ 20 | text, 21 | completed, 22 | ]) 23 | .then(function ([result]) { 24 | return { id: result.insertId, text: text, completed: completed }; 25 | }); 26 | return { 27 | body: newTask, 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /ruby/mysql2/example.rb: -------------------------------------------------------------------------------- 1 | require 'mysql2' 2 | 3 | def connect_to_oceanbase(host, port, username, password, database) 4 | begin 5 | # 创建数据库连接 6 | client = Mysql2::Client.new( 7 | host: host, 8 | port: port, 9 | username: username, 10 | password: password, 11 | database: database 12 | ) 13 | 14 | puts "连接到OceanBase数据库成功" 15 | 16 | # 执行一个简单的查询 17 | results = client.query("SELECT DATABASE();") 18 | 19 | results.each do |row| 20 | puts "连接到的数据库: #{row['DATABASE()']}" 21 | end 22 | 23 | # 你可以在这里执行其他的SQL查询或操作 24 | 25 | client.close 26 | puts "MySQL连接已关闭" 27 | 28 | rescue Mysql2::Error => e 29 | puts "连接到OceanBase数据库失败: #{e.error}" 30 | end 31 | end 32 | 33 | if __FILE__ == $0 34 | connect_to_oceanbase( 35 | '127.0.0.1', 36 | 2881, 37 | 'root', 38 | '', 39 | 'test' 40 | ) 41 | end 42 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode, ViewEncapsulation } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | import { preloaderFinished } from '@delon/theme'; 4 | import { NzSafeAny } from 'ng-zorro-antd/core/types'; 5 | 6 | import { AppModule } from './app/app.module'; 7 | import { environment } from './environments/environment'; 8 | 9 | preloaderFinished(); 10 | 11 | if (environment.production) { 12 | enableProdMode(); 13 | } 14 | 15 | platformBrowserDynamic() 16 | .bootstrapModule(AppModule, { 17 | defaultEncapsulation: ViewEncapsulation.Emulated, 18 | preserveWhitespaces: false 19 | }) 20 | .then(res => { 21 | const win = window as NzSafeAny; 22 | if (win && win.appBootstrap) { 23 | win.appBootstrap(); 24 | } 25 | return res; 26 | }) 27 | .catch(err => console.error(err)); 28 | -------------------------------------------------------------------------------- /applications/sveltekit/src/components/Icons.svelte: -------------------------------------------------------------------------------- 1 | 16 | 17 | {@html icons[name].svg} 20 | -------------------------------------------------------------------------------- /applications/mydata/internal/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | ) 7 | 8 | var ( 9 | ReleaseVersion = "None" 10 | BuildTS = "None" 11 | GitHash = "None" 12 | GitBranch = "None" 13 | GoVersion = "None" 14 | ) 15 | 16 | func LogVersionInfo() { 17 | log.Printf("welcome to use the command, release-version:%s, git-hash:%s, git-branch:%s, utc-build-time:%s, go-version:%s", 18 | ReleaseVersion, GitHash, GitBranch, BuildTS, GoVersion) 19 | } 20 | 21 | func GetRawInfo() string { 22 | var info string 23 | info += fmt.Sprintf("Release version : %s\n", ReleaseVersion) 24 | info += fmt.Sprintf("Git Commit Hash : %s\n", GitHash) 25 | info += fmt.Sprintf("Git Branch : %s\n", GitBranch) 26 | info += fmt.Sprintf("Build Time : %s\n", BuildTS) 27 | info += fmt.Sprintf("Go Version : %s\n", GoVersion) 28 | return info 29 | } 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/layout/basic/widgets/fullscreen.component.ts: -------------------------------------------------------------------------------- 1 | import { ChangeDetectionStrategy, Component, HostListener } from '@angular/core'; 2 | import screenfull from 'screenfull'; 3 | 4 | @Component({ 5 | selector: 'header-fullscreen', 6 | template: ` 7 | 8 | {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }} 9 | `, 10 | host: { 11 | '[class.d-block]': 'true' 12 | }, 13 | changeDetection: ChangeDetectionStrategy.OnPush 14 | }) 15 | export class HeaderFullScreenComponent { 16 | status = false; 17 | 18 | @HostListener('window:resize') 19 | _resize(): void { 20 | this.status = screenfull.isFullscreen; 21 | } 22 | 23 | @HostListener('click') 24 | _click(): void { 25 | if (screenfull.isEnabled) { 26 | screenfull.toggle(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/Makefile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | demo: 19 | docker compose up hertzbeat 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-ftp.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "ftp", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorFTP}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 21 21 | }, 22 | { 23 | "field": "direction", 24 | "type": 1, 25 | "value": "127.0.0.1" 26 | }, 27 | { 28 | "field": "timeout", 29 | "type": 0, 30 | "value": 1000 31 | }, 32 | { 33 | "field": "username", 34 | "type": 1 35 | }, 36 | { 37 | "field": "password", 38 | "type": 1 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "stylelint-config-standard", 4 | "stylelint-config-rational-order", 5 | "stylelint-config-prettier" 6 | ], 7 | "plugins": [ 8 | "stylelint-order", 9 | "stylelint-declaration-block-no-ignored-properties" 10 | ], 11 | "rules": { 12 | "no-descending-specificity": null, 13 | "plugin/declaration-block-no-ignored-properties": true, 14 | "selector-type-no-unknown": [ 15 | true, 16 | { 17 | "ignoreTypes": [ 18 | "/^g2-/", 19 | "/^nz-/", 20 | "/^app-/" 21 | ] 22 | } 23 | ], 24 | "selector-pseudo-element-no-unknown": [ 25 | true, 26 | { 27 | "ignorePseudoElements": [ 28 | "ng-deep" 29 | ] 30 | } 31 | ], 32 | "import-notation": "string" 33 | }, 34 | "ignoreFiles": [ 35 | "src/assets/**/*" 36 | ] 37 | } -------------------------------------------------------------------------------- /golang/gorm/README.md: -------------------------------------------------------------------------------- 1 | # Connect OceanBase with Golang (gorm.io/driver/mysql) 2 | 3 | English | [简体中文](README-CN.md) 4 | 5 | This article describes how to connect to the OceanBase database through `gorm.io/driver/mysql`. 6 | 7 | For details about `gorm.io/driver/mysql`, you can refer to [gorm.io/driver/mysql](https://gorm.io/driver/mysql). 8 | 9 | ## Quick Start 10 | 11 | You can use `conf` to create a database connection, please refer to [gorm.io/docs/](https://gorm.io/docs) for details. 12 | 13 | Take [example.go](example.go) code as an example. 14 | 15 | Modify input parameters in `run.sh`, e.g. `host, port, username, password, database`, and use `run.sh` to run the example code. 16 | 17 | ```bash 18 | sh run.sh 19 | ``` 20 | 21 | ### Use PreparedStatement 22 | 23 | Log in to OceanBase with a root user and run the following command: 24 | 25 | ```bash 26 | alter system set _ob_enable_prepared_statement = true; 27 | ``` 28 | -------------------------------------------------------------------------------- /python/pymysql/README-CN.md: -------------------------------------------------------------------------------- 1 | # Python 连接 OceanBase 指南(PyMySQL) 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过 PyMySQL 驱动连接 OceanBase 数据库。 6 | 7 | ## 快速开始 8 | 9 | 为了防止环境问题,推荐使用 anaconda 配置 python 3.x 环境。 10 | 11 | 在开始之前,需要先确保 PyMySQL 已安装。PyMySQL 是在 Python 3.x 版本中用于连接 MySQL 服务器的依赖库。有关 PyMySQL 的安装和使用等详细信息,您可参考 [官方文档](https://pypi.org/project/PyMySQL/) 和 [相关 API 参考文档](https://pymysql.readthedocs.io/en/latest/modules/index.html)。 12 | 13 | 以 [example.py](example.py) 为例。 14 | 15 | ```python 16 | import pymysql 17 | 18 | conn = pymysql.connect(host="127.0.0.1", port=2881, 19 | user="root@test", passwd="", db="test") 20 | with conn.cursor() as cur: 21 | sql = 'SELECT * FROM t_test' 22 | print("Query sql: ", sql) 23 | cur.execute(sql) 24 | ans = cur.fetchall() 25 | print(ans) 26 | conn.close() 27 | ``` 28 | 29 | 修改代码中的连接信息,之后你就可以直接使用 run.sh 运行示例代码。 30 | 31 | ```bash 32 | sh run.sh 33 | ``` 34 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | import { Environment } from '@delon/theme'; 6 | 7 | export const environment = { 8 | production: false, 9 | useHash: false, 10 | api: { 11 | baseUrl: 'http://localhost:1157/api/', 12 | refreshTokenEnabled: true 13 | } 14 | } as Environment; 15 | 16 | /* 17 | * In development mode, to ignore zone related error stack frames such as 18 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can 19 | * import the following file, but please comment it out in production mode 20 | * because it will have performance impact when throw error 21 | */ 22 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 23 | -------------------------------------------------------------------------------- /golang/gorm/go.sum: -------------------------------------------------------------------------------- 1 | github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= 2 | github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= 3 | github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= 4 | github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= 5 | github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= 6 | github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 7 | gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= 8 | gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= 9 | gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= 10 | gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= 11 | gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= 12 | -------------------------------------------------------------------------------- /python/sqlalchemy/demo/db/base.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # 4 | # Date : 2024-05-29 14:28 5 | # Desc : SQLAlchemy 引擎和 OceanBase 基表定义 6 | from contextlib import contextmanager 7 | from typing import Generator 8 | 9 | from sqlalchemy import create_engine, Column, Integer 10 | from sqlalchemy.orm import sessionmaker 11 | from sqlalchemy.orm import DeclarativeBase 12 | 13 | from .config import ob_db_url as db_url 14 | 15 | 16 | # 创建SQLAlchemy引擎 17 | engine = create_engine(db_url) 18 | # 创建一个 session 类型 19 | Session = sessionmaker(bind=engine) 20 | 21 | 22 | class Base(DeclarativeBase): 23 | id = Column(Integer, primary_key=True, autoincrement=True) 24 | 25 | 26 | @contextmanager 27 | def get_db() -> Generator: 28 | session = Session() 29 | try: 30 | yield session 31 | except Exception: 32 | session.rollback() 33 | raise 34 | finally: 35 | session.close() 36 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | 21 | atest run -p testsuite.yaml --report md 22 | -------------------------------------------------------------------------------- /java/mybatis/src/test/java/com/oceanbase/samples/util/SqlSessionUtil.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.util; 2 | 3 | import org.apache.ibatis.io.Resources; 4 | import org.apache.ibatis.session.SqlSession; 5 | import org.apache.ibatis.session.SqlSessionFactory; 6 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * SqlSessionUtil 12 | */ 13 | public class SqlSessionUtil { 14 | 15 | private SqlSessionUtil() { 16 | } 17 | 18 | private static SqlSessionFactory sqlSessionFactory; 19 | 20 | static { 21 | try { 22 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader("mybatis-config.xml")); 23 | } catch (IOException e) { 24 | throw new RuntimeException(e); 25 | } 26 | } 27 | 28 | public static SqlSession openSession() { 29 | return sqlSessionFactory.openSession(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /applications/mydata/internal/transfor/stdiconv.go: -------------------------------------------------------------------------------- 1 | package transfor 2 | 3 | import ( 4 | "bytes" 5 | "log" 6 | 7 | "github.com/djimenez/iconv-go" 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | func StdIconv(inByte, outByte []byte, fromCode, toCode string) error { 12 | converter, err := iconv.NewConverter(fromCode, toCode) 13 | if err != nil { 14 | return errors.WithStack(err) 15 | } 16 | defer converter.Close() 17 | 18 | read, written, err := converter.Convert(inByte, outByte) 19 | if err != nil { 20 | return errors.WithStack(err) 21 | } 22 | 23 | log.Printf("read:%d, written:%d", read, written) 24 | return nil 25 | } 26 | 27 | func StdIconv2() { 28 | reader, err := iconv.NewReader(bytes.NewReader([]byte("我是中国人")), "utf-8", "gbk") 29 | if err != nil { 30 | panic(err) 31 | } 32 | 33 | buf := make([]byte, 10) 34 | n, err := reader.Read(buf) 35 | if err != nil { 36 | panic(err) 37 | } 38 | 39 | log.Printf("read:%d, buf:%X", n, buf) 40 | } 41 | -------------------------------------------------------------------------------- /java/mybatis/src/test/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /applications/sveltekit/src/components/Todo.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |
  • 9 | toggleTodoCompleted(todo.id, todo.completed)} 14 | class="mr-2 form-checkbox h-5 w-5" 15 | /> 16 | 21 | {todo.text} 22 | 23 | 30 |
  • -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/constants.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export const CONSTANTS = { 21 | VERSION: 'v1.6.0' 22 | }; 23 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/assets/img/notification.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/mydata/cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "os" 7 | 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | var rootCmd = &cobra.Command{ 12 | Use: "mydata", 13 | Short: "A Fast and Flexible export data from remote mysql server", 14 | Long: `A Fast and Flexible export data from remote mysql server`, 15 | Run: func(cmd *cobra.Command, args []string) { 16 | if len(args) == 0 { 17 | _ = cmd.Help() 18 | } 19 | }, 20 | SilenceUsage: true, 21 | } 22 | 23 | var debug bool 24 | 25 | func init() { 26 | log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds) 27 | log.SetOutput(os.Stdout) 28 | 29 | rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "print stack log") 30 | 31 | rootCmd.Flags().SortFlags = false // 禁止flag排序 32 | } 33 | 34 | func Execute() { 35 | rootCmd.SilenceUsage = true 36 | 37 | if err := rootCmd.Execute(); err != nil { 38 | if debug { 39 | fmt.Printf("%+v\n", err) 40 | } 41 | os.Exit(1) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ruby/sequel/README.md: -------------------------------------------------------------------------------- 1 | # Ruby Connection OceanBase Guide (sequel) 2 | 3 | English | [简体中文](README-CN.md) 4 | 5 | This article introduces how to connect to OceanBase database through sequel. 6 | 7 | ## Quick Start 8 | 9 | Before starting, it is necessary to ensure that mysql2,sequel is installed. 10 | 11 | Installation command 12 | 13 | ``` 14 | gem install sequel 15 | gem install mysql2 16 | ``` 17 | 18 | Taking [example.rb](example.rb) as an example. 19 | 20 | ``` 21 | require 'sequel' 22 | 23 | # 连接到OceanBase数据库 24 | DB = Sequel.connect( 25 | adapter: 'mysql2', 26 | host: '127.0.0.1', 27 | port: 2881, 28 | user: 'root', 29 | password: '', 30 | database: 'test' 31 | ) 32 | 33 | if DB.test_connection 34 | puts "成功连接到OceanBase数据库" 35 | else 36 | puts "连接到OceanBase数据库失败" 37 | end 38 | 39 | ``` 40 | 41 | Modify the connection information in the code, and then you can directly run the example code using the command line. 42 | 43 | ```bash 44 | sh run.sh 45 | ``` 46 | -------------------------------------------------------------------------------- /java/oceanbase-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | com.oceanbase.samples 8 | oceanbase-client 9 | 1.0-SNAPSHOT 10 | 11 | ob-samples-oceanbase-client 12 | 13 | 14 | UTF-8 15 | 1.8 16 | 1.8 17 | 18 | 19 | 20 | 21 | com.oceanbase 22 | oceanbase-client 23 | 2.4.8 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/TemplateConfig.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export class TemplateConfig { 21 | apps!: Record; 22 | } 23 | -------------------------------------------------------------------------------- /applications/sveltekit/src/components/TodoForm.svelte: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    12 |
    13 | 14 | 21 |
    22 | 28 |
    29 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/Dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | FROM ghcr.io/linuxsuren/api-testing:v0.0.16 19 | 20 | WORKDIR /workspace 21 | COPY . . 22 | 23 | CMD [ "/workspace/entrypoint.sh" ] 24 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/routes/status-public/status-public.component.less: -------------------------------------------------------------------------------- 1 | @import '@delon/theme/index'; 2 | 3 | .status-header { 4 | width: 100%; 5 | max-width: 100%; 6 | height: 250px; 7 | padding-top: 10px; 8 | padding-bottom: 10px; 9 | background-size: cover; 10 | text-align: center; 11 | } 12 | 13 | .status-logo { 14 | margin-top: 50px; 15 | max-width: 100%; 16 | max-height: 100%; 17 | height: 150px; 18 | } 19 | 20 | .status-content { 21 | width: 100%; 22 | max-width: 100%; 23 | margin-top: 30px; 24 | } 25 | 26 | .org-status { 27 | width: 60%; 28 | font-weight: 600; 29 | font-size: 1.5rem; 30 | line-height: 2.0rem; 31 | border: 4px; 32 | border-radius: 5px; 33 | padding: 0.75rem 1.25rem; 34 | margin: 0 auto; 35 | } 36 | 37 | .component-status { 38 | width: 60%; 39 | margin: 10px auto; 40 | border: 1px dotted gray; 41 | border-radius: 3px; 42 | } 43 | 44 | .history_block { 45 | width: 2.33%; 46 | height: 60px; 47 | margin-right: 1% 48 | } 49 | -------------------------------------------------------------------------------- /applications/mydata/cmd/hex.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "encoding/hex" 5 | "log" 6 | "os" 7 | 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | var hexCmd = &cobra.Command{ 12 | Use: "hex", 13 | Short: "Convert hex string to byte", 14 | RunE: writeE, 15 | } 16 | 17 | var in string 18 | var out string 19 | 20 | func init() { 21 | hexCmd.Flags().StringVarP(&in, "in", "i", "", "hex string") 22 | hexCmd.Flags().StringVarP(&out, "out", "o", "", "out file name") 23 | 24 | hexCmd.MarkFlagRequired("in") 25 | hexCmd.MarkFlagRequired("out") 26 | 27 | rootCmd.AddCommand(hexCmd) 28 | } 29 | 30 | func writeE(cmd *cobra.Command, args []string) error { 31 | log.Printf(">>> %s", in) 32 | 33 | decodeString, err := hex.DecodeString(in) 34 | if err != nil { 35 | return err 36 | } 37 | 38 | f, err := os.Create(out) 39 | if err != nil { 40 | return err 41 | } 42 | defer f.Close() 43 | 44 | _, err = f.Write(decodeString) 45 | if err != nil { 46 | return err 47 | } 48 | 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /java/mybatis/src/test/resources/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 16 | delete from user where id = #{id}; 17 | 18 | 19 | 20 | insert into user (name) values (#{name}); 21 | 22 | 23 | 24 | update user set name = #{name} where id = #{id}; 25 | 26 | 27 | -------------------------------------------------------------------------------- /java/mysql-connector-java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | com.oceanbase.samples 8 | mysql-connector-java 9 | 1.0-SNAPSHOT 10 | 11 | ob-samples-mysql-connector-java 12 | 13 | 14 | UTF-8 15 | 1.8 16 | 1.8 17 | 18 | 19 | 20 | 21 | mysql 22 | mysql-connector-java 23 | 8.0.28 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java/springboot/src/test/java/com/oceanbase/samples/springboot/SpringBootJavaApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.oceanbase.samples.springboot; 2 | 3 | import com.oceanbase.samples.springboot.repository.StaffEntityRepository; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | 7 | import javax.annotation.Resource; 8 | 9 | @SpringBootTest(classes = SpringBootJavaApplication.class) 10 | public class SpringBootJavaApplicationTest { 11 | 12 | @Resource 13 | private StaffEntityRepository staffEntityRepository; 14 | 15 | 16 | @Test 17 | public void findByTestName() { 18 | assert staffEntityRepository.findByTestName("test") != null; 19 | } 20 | 21 | @Test 22 | public void findByTestNameContaining() { 23 | assert staffEntityRepository.findByTestNameContaining("test") != null; 24 | } 25 | 26 | @Test 27 | public void findById() { 28 | boolean b = staffEntityRepository.findById(1) == null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /applications/hertzbeat/push/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 17 | org.apache.hertzbeat.push.config.PushAutoConfiguration -------------------------------------------------------------------------------- /applications/hertzbeat/script/ext-lib/README: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | Please move external libs to this folder like: 17 | 18 | ojdbc8-21.5.0.0.jar 19 | orai18n-21.5.0.0.jar 20 | mysql-connector-java-8.0.30.jar 21 | 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/common/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 18 | org.apache.hertzbeat.common.config.CommonConfig 19 | -------------------------------------------------------------------------------- /applications/hertzbeat/warehouse/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 17 | org.apache.hertzbeat.warehouse.WarehouseAutoConfiguration -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/Message.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export class Message { 21 | data!: T; 22 | msg!: string; 23 | code: number = 0; 24 | } 25 | -------------------------------------------------------------------------------- /applications/hertzbeat/alerter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 17 | org.apache.hertzbeat.alert.config.AlerterAutoConfiguration 18 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/layout/passport/passport.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Inject, OnInit } from '@angular/core'; 2 | import { I18NService } from '@core'; 3 | import { DA_SERVICE_TOKEN, ITokenService } from '@delon/auth'; 4 | import { ALAIN_I18N_TOKEN } from '@delon/theme'; 5 | 6 | import { CONSTANTS } from '../../shared/constants'; 7 | 8 | @Component({ 9 | selector: 'layout-passport', 10 | templateUrl: './passport.component.html', 11 | styleUrls: ['./passport.component.less'] 12 | }) 13 | export class LayoutPassportComponent implements OnInit { 14 | version = CONSTANTS.VERSION; 15 | links = [ 16 | { 17 | title: this.i18nSvc.fanyi('app.passport.welcome'), 18 | href: 'https://console.tancloud.cn' 19 | } 20 | ]; 21 | 22 | currentYear = new Date().getFullYear(); 23 | 24 | constructor(@Inject(DA_SERVICE_TOKEN) private tokenService: ITokenService, @Inject(ALAIN_I18N_TOKEN) private i18nSvc: I18NService) {} 25 | 26 | ngOnInit(): void { 27 | this.tokenService.clear(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/collector/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 17 | org.apache.hertzbeat.collector.config.CollectorAutoConfiguration 18 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/SystemConfig.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export class SystemConfig { 21 | timeZoneId!: string; 22 | locale!: string; 23 | theme!: string; 24 | } 25 | -------------------------------------------------------------------------------- /javascript/typeorm/index.ts: -------------------------------------------------------------------------------- 1 | import { DataSource } from "typeorm"; 2 | import { Entity, Column, PrimaryGeneratedColumn } from "typeorm"; 3 | import "reflect-metadata"; 4 | 5 | @Entity({ name: "users" }) 6 | export default class User { 7 | @Column() 8 | @PrimaryGeneratedColumn() 9 | id: number; 10 | 11 | @Column({ unique: true }) 12 | email: string; 13 | 14 | @Column() 15 | name: string; 16 | } 17 | 18 | const dataSource = new DataSource({ 19 | type: "mysql", 20 | url: "mysql://root:@127.0.0.1:2881/test", 21 | entities: [User], 22 | synchronize: true, 23 | }); 24 | 25 | dataSource 26 | .initialize() 27 | .then(async () => { 28 | const userRepository = dataSource.getRepository(User); 29 | await userRepository.save({ 30 | name: "Alice", 31 | email: "alice@oceanbase.com", 32 | }); 33 | const allUsers = await userRepository.find(); 34 | console.log(allUsers); 35 | dataSource.destroy(); 36 | }) 37 | .catch((err) => { 38 | console.error(err); 39 | dataSource.destroy(); 40 | }); 41 | -------------------------------------------------------------------------------- /applications/mydata/internal/file/merge.go: -------------------------------------------------------------------------------- 1 | package file 2 | 3 | import ( 4 | "io" 5 | "log" 6 | "os" 7 | 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | func MergeAndCleanN(dstName string, srcNames []string) error { 12 | buf := make([]byte, 64*1024) 13 | dst, err := os.OpenFile(dstName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, os.ModePerm) 14 | if err != nil { 15 | return errors.WithStack(err) 16 | } 17 | defer dst.Close() 18 | 19 | for _, srcName := range srcNames { 20 | if err := func() error { 21 | src, err := os.OpenFile(srcName, os.O_RDONLY, os.ModePerm) 22 | if err != nil { 23 | return errors.WithStack(err) 24 | } 25 | defer src.Close() 26 | 27 | written, err := io.CopyBuffer(dst, src, buf) 28 | if err != nil { 29 | return errors.WithStack(err) 30 | } 31 | log.Printf("merge file:%s, byte size:%d", srcName, written) 32 | 33 | return nil 34 | }(); err != nil { 35 | return err 36 | } 37 | 38 | if err := os.Remove(srcName); err != nil { 39 | return errors.WithStack(err) 40 | } 41 | } 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /applications/sveltekit/src/components/Auth.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |

    Log In

    9 |

    Sign in via magic link with your email below.

    10 |
    11 |
    12 | 13 | 20 |
    21 | 28 |
    29 | -------------------------------------------------------------------------------- /applications/mydata/internal/file/outfile.go: -------------------------------------------------------------------------------- 1 | package file 2 | 3 | import ( 4 | "bufio" 5 | "os" 6 | 7 | "github.com/pkg/errors" 8 | ) 9 | 10 | type MyOutfile struct { 11 | f *os.File 12 | w *bufio.Writer 13 | Err error 14 | } 15 | 16 | func NewMyOutFile(fileName string, bufSize int) (*MyOutfile, error) { 17 | outFile, err := os.Create(fileName) 18 | if err != nil { 19 | return nil, errors.Wrapf(err, "file:%s", fileName) 20 | } 21 | 22 | return &MyOutfile{ 23 | f: outFile, 24 | w: bufio.NewWriterSize(outFile, bufSize), 25 | }, nil 26 | } 27 | 28 | func (my *MyOutfile) WriteSingleByte(c byte) { 29 | if my.Err == nil { 30 | my.Err = my.w.WriteByte(c) 31 | } 32 | } 33 | 34 | func (my *MyOutfile) Write(p []byte) { 35 | if my.Err == nil { 36 | if n, err1 := my.w.Write(p); err1 != nil || n != len(p) { 37 | my.Err = errors.Wrapf(err1, "wrote %d, want %d", n, len(p)) 38 | } 39 | } 40 | } 41 | 42 | func (my *MyOutfile) Close() { 43 | if my.Err == nil { 44 | my.Err = my.w.Flush() 45 | } 46 | 47 | if my.Err == nil { 48 | my.Err = my.f.Close() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-mysql-iotdb/conf/sql/schema.sql: -------------------------------------------------------------------------------- 1 | -- Licensed to the Apache Software Foundation (ASF) under one 2 | -- or more contributor license agreements. See the NOTICE file 3 | -- distributed with this work for additional information 4 | -- regarding copyright ownership. The ASF licenses this file 5 | -- to you under the Apache License, Version 2.0 (the 6 | -- "License"); you may not use this file except in compliance 7 | -- with the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | 17 | -- this file works for MySQL. 18 | 19 | set names utf8mb4; 20 | create database if not exists hertzbeat default charset utf8mb4 collate utf8mb4_general_ci; 21 | commit; -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/Param.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export class Param { 21 | id!: number; 22 | field!: string; 23 | type: number | undefined; 24 | paramValue: any; 25 | // 是否显示 26 | display: boolean = true; 27 | } 28 | -------------------------------------------------------------------------------- /applications/mydata/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | REPO := mydata 4 | 5 | GOOS := $(if $(GOOS),$(GOOS),$(shell go env GOOS)) 6 | GOARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) 7 | GOENV := GO111MODULE=on CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) 8 | GO := $(GOENV) go 9 | GOBUILD := $(GO) build -trimpath 10 | GORUN := $(GO) run 11 | SHELL := /usr/bin/env bash 12 | 13 | COMMIT := $(shell git describe --always --no-match --tags --dirty="-dev") 14 | BUILDTS := $(shell date '+%Y-%m-%d %H:%M:%S') 15 | GITHASH := $(shell git rev-parse HEAD) 16 | GITREF := $(shell git rev-parse --abbrev-ref HEAD) 17 | GOVER := $(shell go version) 18 | 19 | LDFLAGS := -w -s 20 | LDFLAGS += -X "$(REPO)/internal/version.ReleaseVersion=$(COMMIT)" 21 | LDFLAGS += -X "$(REPO)/internal/version.BuildTS=$(BUILDTS)" 22 | LDFLAGS += -X "$(REPO)/internal/version.GitHash=$(GITHASH)" 23 | LDFLAGS += -X "$(REPO)/internal/version.GitBranch=$(GITREF)" 24 | LDFLAGS += -X "$(REPO)/internal/version.GoVersion=$(GOVER)" 25 | 26 | all: mydata 27 | 28 | mydata: 29 | $(GOBUILD) -ldflags '$(LDFLAGS)' -o ./dist/mydata main.go 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-mysql-tdengine/conf/sql/schema.sql: -------------------------------------------------------------------------------- 1 | -- Licensed to the Apache Software Foundation (ASF) under one 2 | -- or more contributor license agreements. See the NOTICE file 3 | -- distributed with this work for additional information 4 | -- regarding copyright ownership. The ASF licenses this file 5 | -- to you under the Apache License, Version 2.0 (the 6 | -- "License"); you may not use this file except in compliance 7 | -- with the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | 17 | -- this file works for MySQL. 18 | 19 | set names utf8mb4; 20 | create database if not exists hertzbeat default charset utf8mb4 collate utf8mb4_general_ci; 21 | commit; -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-mysql-victoria-metrics/conf/sql/schema.sql: -------------------------------------------------------------------------------- 1 | -- Licensed to the Apache Software Foundation (ASF) under one 2 | -- or more contributor license agreements. See the NOTICE file 3 | -- distributed with this work for additional information 4 | -- regarding copyright ownership. The ASF licenses this file 5 | -- to you under the Apache License, Version 2.0 (the 6 | -- "License"); you may not use this file except in compliance 7 | -- with the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | 17 | -- this file works for MySQL. 18 | 19 | set names utf8mb4; 20 | create database if not exists hertzbeat default charset utf8mb4 collate utf8mb4_general_ci; 21 | commit; -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-mysql-iotdb/README_CN.md: -------------------------------------------------------------------------------- 1 | ## docker-compose部署 HertzBeat+Mysql+IoTDB 方案 2 | 3 | - 如果想自己本地快速部署的话,可以参考下面进行操作。 4 | 5 | > docker-compose 部署方案使用了 Mysql + IoTDB 作为 Hertzbeat 依赖存储服务。 6 | > 此方案会启动三个容器服务 Mysql, IoTDB, HertzBeat 7 | 8 | ##### 安装Docker & Docker-compose 9 | 10 | 1. 下载安装 docker 环境 & docker-compose 环境 11 | 请参考 [Docker官网文档](https://docs.docker.com/get-docker/), [Compose安装](https://docs.docker.com/compose/install/) 12 | ``` 13 | $ docker -v 14 | Docker version 20.10.12, build e91ed57 15 | ``` 16 | 17 | ##### docker compose部署hertzbeat及其依赖服务 18 | 19 | 1. 下载hertzbeat-docker-compose安装部署脚本文件 20 | 脚本文件位于代码仓库下`script/docker-compose/hertzbeat-mysql-iotdb` 链接 [script/docker-compose](https://github.com/hertzbeat/hertzbeat/tree/master/script/docker-compose/hertzbeat-mysql-iotdb) 21 | 22 | 23 | 2. 进入部署脚本 docker-compose 目录, 执行 24 | 25 | `docker compose up -d` 26 | 27 | 28 | ##### 开始探索HertzBeat 29 | 30 | 浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat` 31 | 32 | --- 33 | 34 | 怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧! 35 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/backend/LICENSE-mssql-jdbc.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), 3 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 4 | and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions : 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 11 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/CollectorSummary.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import { Collector } from './Collector'; 21 | 22 | export class CollectorSummary { 23 | collector!: Collector; 24 | pinMonitorNum!: number; 25 | dispatchMonitorNum!: number; 26 | } 27 | -------------------------------------------------------------------------------- /applications/hertzbeat/e2e/data/monitor-website.json: -------------------------------------------------------------------------------- 1 | { 2 | "detected": false, 3 | "collector": "", 4 | "monitor": { 5 | "intervals": 60, 6 | "tags": [], 7 | "app": "website", 8 | "host": "127.0.0.1", 9 | "name": "{{.param.monitorWebsite}}" 10 | }, 11 | "params": [ 12 | { 13 | "field": "host", 14 | "type": 1, 15 | "value": "127.0.0.1" 16 | }, 17 | { 18 | "field": "port", 19 | "type": 0, 20 | "value": 80 21 | }, 22 | { 23 | "field": "uri", 24 | "type": 1 25 | }, 26 | { 27 | "field": "ssl", 28 | "type": 1, 29 | "value": false 30 | }, 31 | { 32 | "field": "timeout", 33 | "type": 0 34 | }, 35 | { 36 | "field": "authType", 37 | "type": 1 38 | }, 39 | { 40 | "field": "username", 41 | "type": 1 42 | }, 43 | { 44 | "field": "password", 45 | "type": 1 46 | }, 47 | { 48 | "field": "keyword", 49 | "type": 1 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-tinycolor.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Scott Cooper 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/AppCount.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | export class AppCount { 21 | category!: string; 22 | app!: string; 23 | size: number = 0; 24 | availableSize: number = 0; 25 | unManageSize: number = 0; 26 | unAvailableSize: number = 0; 27 | } 28 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-lie.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) 2014-2018 Calvin Metcalf, Jordan Harband 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.** 8 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-postgresql-iotdb/README_CN.md: -------------------------------------------------------------------------------- 1 | ## docker-compose部署 HertzBeat+Postgresql+IoTDB 方案 2 | 3 | - 如果想自己本地快速部署的话,可以参考下面进行操作。 4 | 5 | > docker-compose 部署方案使用了 PostgreSQL + IoTDB 作为 Hertzbeat 依赖存储服务。 6 | > 此方案会启动三个容器服务 PostgreSQL, IoTDB, HertzBeat 7 | 8 | ##### 安装Docker & Docker-compose 9 | 10 | 1. 下载安装 docker 环境 & docker-compose 环境 11 | 请参考 [Docker官网文档](https://docs.docker.com/get-docker/), [Compose安装](https://docs.docker.com/compose/install/) 12 | ``` 13 | $ docker -v 14 | Docker version 20.10.12, build e91ed57 15 | ``` 16 | 17 | ##### docker compose部署hertzbeat及其依赖服务 18 | 19 | 1. 下载hertzbeat-docker-compose安装部署脚本文件 20 | 脚本文件位于代码仓库下`script/docker-compose/hertzbeat-postgre-iotdb` 链接 [script/docker-compose](https://github.com/hertzbeat/hertzbeat/tree/master/script/docker-compose/hertzbeat-postgre-iotdb) 21 | 22 | 23 | 2. 进入部署脚本 docker-compose 目录, 执行 24 | 25 | `docker compose up -d` 26 | 27 | 28 | ##### 开始探索HertzBeat 29 | 30 | 浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat` 31 | 32 | --- 33 | 34 | 怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧! 35 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/helm/hertzbeat/templates/tsdb/configmap.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | apiVersion: v1 19 | kind: ConfigMap 20 | metadata: 21 | name: "{{ include "hertzbeat.tsdb" . }}" 22 | labels: 23 | {{- include "hertzbeat.labels" . | nindent 4 }} 24 | data: 25 | TZ: "{{ .Values.database.timezone }}" 26 | -------------------------------------------------------------------------------- /c_cplusplus/mysql-connector-cpp/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # find mysql connector c++ headers 4 | echo "Searching for MySQL Connector/C++ headers..." 5 | POSSIBLE_PATHS="/usr/include/mysql-cppconn-8/jdbc /usr/include/mysql-cppconn-8 /usr/include/" 6 | 7 | # find actual header file location 8 | for path in $POSSIBLE_PATHS; do 9 | if [ -f "$path/cppconn/driver.h" ] || [ -f "$path/driver.h" ]; then 10 | INCLUDE_PATH=$path 11 | echo "Found headers in: $INCLUDE_PATH" 12 | break 13 | fi 14 | done 15 | 16 | if [ -z "$INCLUDE_PATH" ]; then 17 | echo "Error: Could not find MySQL Connector/C++ headers" 18 | echo "Please check if libmysqlcppconn-dev is properly installed" 19 | echo "You can install it with: sudo apt-get install libmysqlcppconn-dev" 20 | exit 1 21 | fi 22 | 23 | # compile 24 | echo "=== Compiling ===" 25 | g++ -std=c++11 -I$INCLUDE_PATH src/mysql_connector_test.cpp -o mysql_connector_test -lmysqlcppconn 26 | 27 | # check compile result 28 | if [ $? -ne 0 ]; then 29 | echo "Compilation failed" 30 | exit 1 31 | fi 32 | 33 | # run 34 | echo "=== Running ===" 35 | ./mysql_connector_test "$@" -------------------------------------------------------------------------------- /golang/go-sql-driver/README-CN.md: -------------------------------------------------------------------------------- 1 | # Golang 连接 OceanBase 指南(使用 go-sql-driver/mysql) 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过 `go-sql-driver/mysql` 连接 OceanBase 数据库。 6 | 7 | 关于 `go-sql-driver/mysql` 的详细信息,您可参考 [https://github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)。 8 | 9 | ## 快速开始 10 | 11 | 您需要使用 dataSourceName 来创建数据库连接,详细信息请参考 [go-sql-driver/mysql 文档](https://github.com/go-sql-driver/mysql#dsn-data-source-name)。 12 | 13 | 以 [example.go](example.go) 代码为例 14 | 15 | ```go 16 | var ( 17 | host = "127.0.0.1" 18 | port = 2881 19 | dbName = "test" 20 | username = "root@test" 21 | password = "" 22 | ) 23 | dataSourceName := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", username, password, host, port, dbName) 24 | 25 | db, err := sql.Open("mysql", dataSourceName) 26 | if err != nil { 27 | log.Fatal(err) 28 | } 29 | defer db.Close() 30 | ``` 31 | 32 | 修改代码中的连接信息,之后你就可以直接使用 run.sh 运行示例代码。 33 | 34 | ```bash 35 | sh run.sh 36 | ``` 37 | 38 | ### 使用 PreparedStatement 39 | 40 | 使用 root 用户登录 OceanBase,运行如下命令: 41 | 42 | ```bash 43 | alter system set _ob_enable_prepared_statement = true; 44 | ``` 45 | -------------------------------------------------------------------------------- /javascript/prisma/prisma/schema.prisma: -------------------------------------------------------------------------------- 1 | // This is your Prisma schema file, 2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema 3 | 4 | generator client { 5 | provider = "prisma-client-js" 6 | } 7 | 8 | datasource db { 9 | provider = "mysql" 10 | url = env("DATABASE_URL") 11 | } 12 | 13 | model Post { 14 | id Int @id @default(autoincrement()) 15 | createdAt DateTime @default(now()) 16 | updatedAt DateTime @updatedAt 17 | title String @db.VarChar(255) 18 | content String? 19 | published Boolean @default(false) 20 | author User @relation(fields: [authorId], references: [id]) 21 | authorId Int 22 | 23 | @@map("posts") 24 | } 25 | 26 | model Profile { 27 | id Int @id @default(autoincrement()) 28 | bio String? 29 | user User @relation(fields: [userId], references: [id]) 30 | userId Int @unique 31 | 32 | @@map("profiles") 33 | } 34 | 35 | model User { 36 | id Int @id @default(autoincrement()) 37 | email String @unique 38 | name String? 39 | posts Post[] 40 | profile Profile? 41 | 42 | @@map("users") 43 | } 44 | -------------------------------------------------------------------------------- /applications/hertzbeat/manager/src/main/java/org/apache/hertzbeat/manager/service/NoticeDispatchService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.hertzbeat.manager.service; 19 | 20 | /** 21 | * Message notification forwarding interface 22 | */ 23 | public interface NoticeDispatchService { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "forceConsistentCasingInFileNames": true, 7 | "strict": true, 8 | "noImplicitReturns": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "sourceMap": true, 11 | "declaration": false, 12 | "downlevelIteration": true, 13 | "experimentalDecorators": true, 14 | "moduleResolution": "node", 15 | "importHelpers": true, 16 | "target": "ES2022", 17 | "module": "es2020", 18 | "lib": [ 19 | "es2018", 20 | "dom" 21 | ], 22 | "paths": { 23 | "@shared": [ 24 | "src/app/shared/index" 25 | ], 26 | "@core": [ 27 | "src/app/core/index" 28 | ], 29 | "@env/*": [ 30 | "src/environments/*" 31 | ] 32 | }, 33 | "useDefineForClassFields": false 34 | }, 35 | "angularCompilerOptions": { 36 | "enableI18nLegacyMessageIdFormat": false, 37 | "strictInjectionParameters": true, 38 | "strictInputAccessModifiers": true, 39 | "strictTemplates": true 40 | } 41 | } -------------------------------------------------------------------------------- /.github/workflows/java.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/java.yml' 7 | - 'java/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/java.yml' 11 | - 'java/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'mybatis' 19 | with_oceanbase_container: true 20 | - name: 'mybatis-plus' 21 | with_oceanbase_container: false 22 | - name: 'mysql-connector-java' 23 | with_oceanbase_container: true 24 | - name: 'oceanbase-client' 25 | with_oceanbase_container: true 26 | - name: 'spring-jdbc' 27 | with_oceanbase_container: true 28 | - name: 'springboot' 29 | with_oceanbase_container: true 30 | - name: 'testcontainers-java' 31 | with_oceanbase_container: false 32 | uses: ./.github/workflows/basic-workflow.yml 33 | with: 34 | language: 'java' 35 | module: ${{ matrix.module.name }} 36 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} 37 | -------------------------------------------------------------------------------- /applications/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/redfish/Session.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.hertzbeat.collector.collect.redfish; 19 | 20 | /** 21 | * Redfish session 22 | */ 23 | public record Session(String token, String location, String host, Integer port) {} 24 | -------------------------------------------------------------------------------- /python/pymysql/example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import pymysql 4 | 5 | if __name__ == "__main__": 6 | conn = pymysql.connect(host="127.0.0.1", port=2881, 7 | user="root@test", passwd="", db="test") 8 | print("Success to connect to OceanBase with pymysql") 9 | 10 | sqls = ['DROP TABLE IF EXISTS `t_test`', 11 | 'CREATE TABLE `t_test` (' 12 | ' `id` int(10) NOT NULL AUTO_INCREMENT, ' 13 | ' `name` varchar(20) DEFAULT NULL, ' 14 | ' PRIMARY KEY (`id`)' 15 | ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_bin', 16 | 'INSERT INTO `t_test` VALUES (default, "Hello OceanBase")'] 17 | 18 | # execute sql script 19 | with conn.cursor() as cur: 20 | for sql in sqls: 21 | print("Exec sql: " + sql) 22 | cur.execute(sql) 23 | 24 | # query on test table 25 | with conn.cursor() as cur: 26 | sql = 'SELECT * FROM `t_test`' 27 | print("Query sql: ", sql) 28 | cur.execute(sql) 29 | ans = cur.fetchall() 30 | print("Get rows: ") 31 | print(ans) 32 | conn.close() 33 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker/server/README.md: -------------------------------------------------------------------------------- 1 | ## Use the buildx to build Docker images that support multiple system architectures 2 | 3 | > https://vuepress.mirror.docker-practice.com/buildx/multi-arch-images/ 4 | 5 | 6 | ```shell 7 | $ docker buildx create --use --name=mybuilder-cn --driver docker-container --driver-opt image=dockerpracticesig/buildkit:master 8 | 9 | # for tencent environment 10 | $ docker buildx create --use --name=mybuilder-cn --driver docker-container --driver-opt image=dockerpracticesig/buildkit:master-tencent 11 | 12 | $ docker buildx create --use --name mybuilder --driver docker-container 13 | 14 | $ docker buildx use mybuilder 15 | 16 | ``` 17 | 18 | #### Build the image 19 | 20 | ```shell 21 | # Use the --platform flag to specify the target platforms for the build --push flag to push the image to a registry 22 | $ docker buildx build --platform linux/arm64,linux/amd64 -t apache/hertzbeat:v1.0.0 . --push 23 | 24 | $ docker buildx build --platform linux/arm64,linux/amd64 -t quay.io/tancloud/hertzbeat:latest . --push 25 | 26 | # Inspect the image info 27 | $ docker buildx imagetools inspect apache/hertzbeat:v1.0.0 28 | 29 | ``` 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker-compose/hertzbeat-mysql-victoria-metrics/README_CN.md: -------------------------------------------------------------------------------- 1 | ## docker-compose部署 HertzBeat+Mysql+VictoriaMetrics 方案 2 | 3 | - 如果想自己本地快速部署的话,可以参考下面进行操作。 4 | 5 | > docker-compose 部署方案使用了 Mysql + VictoriaMetrics 作为 Hertzbeat 依赖存储服务。 6 | > 此方案会启动三个容器服务 Mysql, VictoriaMetrics, HertzBeat 7 | 8 | ##### 安装Docker & Docker-compose 9 | 10 | 1. 下载安装 docker 环境 & docker-compose 环境 11 | 请参考 [Docker官网文档](https://docs.docker.com/get-docker/), [Compose安装](https://docs.docker.com/compose/install/) 12 | ``` 13 | $ docker -v 14 | Docker version 20.10.12, build e91ed57 15 | ``` 16 | 17 | ##### docker compose部署hertzbeat及其依赖服务 18 | 19 | 1. 下载hertzbeat-docker-compose安装部署脚本文件 20 | 脚本文件位于代码仓库下`script/docker-compose/hertzbeat-mysql-victoria-metrics` 链接 [script/docker-compose](https://github.com/hertzbeat/hertzbeat/tree/master/script/docker-compose/hertzbeat-mysql-mysql-victoria-metrics) 21 | 22 | 23 | 2. 进入部署脚本 docker-compose 目录, 执行 24 | 25 | `docker compose up -d` 26 | 27 | ##### 开始探索HertzBeat 28 | 29 | 浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat` 30 | 31 | --- 32 | 33 | 怎么样是不是很简单,只要几分钟就可以部署完成,赶紧试试吧! 34 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/README.md: -------------------------------------------------------------------------------- 1 | ## Hertzbeat Web-App 2 | 3 | > [!NOTE] 4 | > 5 | > HertzBeat Web-App is a fork to [ng-alain](https://github.com/ng-alain/ng-alain/). Check [LICENSE](/LICENSE) and [license-ng-alain.txt](/material/licenses/frontend/LICENSE-ng-alain.txt) for more details. 6 | 7 | 8 | ### Quickly Start 9 | 10 | 1. Need `Node Yarn` Environment, Make sure `Node.js >= 18` 11 | 2. Install yarn if not existed `npm install -g yarn` 12 | 3. Execute `yarn install` or `yarn install --registry=https://registry.npmmirror.com` in `web-app` 13 | 4. Install angular-cli : `yarn global add @angular/cli@15` or `yarn global add @angular/cli@15 --registry=https://registry.npmmirror.com` 14 | 5. Start After Backend Server Available : `ng serve --open` 15 | 16 | 17 | ### Build HertzBeat Install Package 18 | 19 | 1. Execute command in web-app 20 | 21 | ```ng build --configuration production``` 22 | 23 | 2. Execute command in root 24 | 25 | ```mvn clean install``` 26 | 27 | The HertzBeat install package will at `manager/target/hertzbeat-{version}.tar.gz` 28 | 29 | 3. Execute command in collector 30 | 31 | ```mvn clean package -Pcluster``` 32 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/pipe/timezone.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import { TimezonePipe } from './timezone.pipe'; 21 | 22 | describe('TimezonePipe', () => { 23 | it('create an instance', () => { 24 | const pipe = new TimezonePipe(); 25 | expect(pipe).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /applications/sveltekit/README.md: -------------------------------------------------------------------------------- 1 | # Full Stack App with SvelteKit and OceanBase 2 | 3 | This project demonstrates how to build a fullstack app using SvelteKit for the frontend and OceanBase as the database. The application is a simple Todo app that allows users to create, read, update, and delete tasks. 4 | 5 | ## Technologies Used 6 | 7 | - SvelteKit: A framework for building web applications of all sizes. 8 | - OceanBase: A distributed relational database management system developed by Ant Group. 9 | - MySQL2: A MySQL driver for Node.js. 10 | - Tailwind CSS: A utility-first CSS framework for rapidly building custom user interfaces. 11 | 12 | ## Setup 13 | 14 | 1. Clone the repository to your local machine. 15 | 16 | 2. Navigate to the project directory. 17 | 18 | ``` 19 | cd applications/sveltekit 20 | ``` 21 | 22 | 3. Install the necessary dependencies. 23 | 24 | ``` 25 | npm i 26 | ``` 27 | 28 | 4. Update the [db.js](./src/lib/db.js) with your own OceanBase database credentials. 29 | 30 | 5. Start the development server. 31 | ``` 32 | npm run dev 33 | ``` 34 | 6. Open your browser and navigate to `http://localhost:3000` to view the app. 35 | -------------------------------------------------------------------------------- /.github/workflows/javascript.yml: -------------------------------------------------------------------------------- 1 | name: JavaScript CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/javascript.yml' 7 | - 'javascript/**' 8 | pull_request: 9 | paths: 10 | - '.github/workflows/javascript.yml' 11 | - 'javascript/**' 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | module: 18 | - name: 'mysql2' 19 | with_oceanbase_container: true 20 | 21 | - name: 'sequelize' 22 | with_oceanbase_container: true 23 | 24 | - name: 'prisma' 25 | with_oceanbase_container: true 26 | oceanbase_image_tag: '4.2.2' 27 | 28 | - name: 'typeorm' 29 | with_oceanbase_container: true 30 | 31 | - name: 'drizzle' 32 | with_oceanbase_container: true 33 | oceanbase_image_tag: '4.2.3_BETA' 34 | 35 | uses: ./.github/workflows/basic-workflow.yml 36 | with: 37 | language: 'javascript' 38 | module: ${{ matrix.module.name }} 39 | with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} 40 | oceanbase_image_tag: ${{ matrix.module.oceanbase_image_tag }} 41 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/AlertDefineBind.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import { Monitor } from './Monitor'; 21 | 22 | export class AlertDefineBind { 23 | id!: number; 24 | alertDefineId!: number; 25 | monitorId!: number; 26 | monitor!: Monitor; 27 | gmtCreate!: number; 28 | gmtUpdate!: number; 29 | } 30 | -------------------------------------------------------------------------------- /applications/mydata/internal/dbinfo/mysql.go: -------------------------------------------------------------------------------- 1 | package dbinfo 2 | 3 | import ( 4 | "database/sql" 5 | "log" 6 | "strconv" 7 | 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | func GetStep4MySQL(db *sql.DB, query string, conc int) (int64, error) { 12 | explain := "explain " + query 13 | 14 | log.Printf("get step by conc:[%s]", explain) 15 | rows, err := db.Query(explain) 16 | if err != nil { 17 | return 0, errors.WithStack(err) 18 | } 19 | defer rows.Close() 20 | 21 | scanArgs, scanVals, err := MakeScanBuf(rows) 22 | if err != nil { 23 | return 0, err 24 | } 25 | 26 | if len(scanArgs) != 12 { 27 | return 0, errors.New("not mysql v8.x") 28 | } 29 | 30 | for rows.Next() { 31 | if err := rows.Scan(scanArgs...); err != nil { 32 | return 0, errors.WithStack(err) 33 | } 34 | // only scan first row 35 | break 36 | } 37 | 38 | // for mysql 8.x 39 | parseInt, err := strconv.ParseInt(string(scanVals[9]), 10, 64) 40 | if err != nil { 41 | return 0, errors.WithStack(err) 42 | } 43 | 44 | step := parseInt/int64(conc) + 1 45 | log.Printf("explain want to result size, rows:%s=>int:%d, step:%d", scanVals[9], parseInt, step) 46 | 47 | return step, nil 48 | } 49 | -------------------------------------------------------------------------------- /javascript/mysql2/README-CN.md: -------------------------------------------------------------------------------- 1 | # javascript连接OceanBase 指南 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过javascript连接 OceanBase 数据库。 6 | 7 | ## 准备工作 8 | 9 | 需要创建一个项目,确认nodejs,npm,mysql2已经安装安装。 10 | 11 | 命令 12 | 13 | ``` 14 | mkdir example 15 | cd example 16 | npm init -y 17 | 18 | npm install mysql2 19 | 20 | ``` 21 | 22 | 创建 [index.js](index.js) 文件 23 | 24 | ``` 25 | const mysql = require('mysql2'); 26 | 27 | const connection = mysql.createConnection({ 28 | host: '127.0.0.1', // OceanBase服务器地址 29 | port: 2881, // OceanBase端口 30 | user: 'root', // 数据库用户名 31 | password: '', // 数据库密码 32 | database: 'test' // 数据库名称 33 | }); 34 | 35 | // 连接到数据库 36 | connection.connect(error => { 37 | if (error) { 38 | return console.error('连接到OceanBase数据库失败: ' + error.message); 39 | } 40 | 41 | console.log('成功连接到OceanBase数据库'); 42 | 43 | // 这里可以执行其他数据库操作 44 | 45 | // 关闭连接 46 | connection.end(err => { 47 | if (err) { 48 | return console.error('关闭数据库连接失败: ' + err.message); 49 | } 50 | console.log('关闭数据库连接成功'); 51 | }); 52 | }); 53 | ``` 54 | 55 | 修改代码中的连接信息,之后你就可以直接使用命令行运行示例代码。 56 | 57 | ```bash 58 | sh run.sh 59 | ``` 60 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-csstype.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2018 Fredrik Nicol 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-dagre.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2014 Chris Pettitt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-graphlib.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2014 Chris Pettitt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-hotkey.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019-2020 GitHub, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-FileSaver.js.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright © 2016 [Eli Grey][1]. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | [1]: http://eligrey.com 12 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-core-js.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2024 Denis Pushkarev 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/shared/pipe/elapsed-time.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import { ElapsedTimePipe } from './elapsed-time.pipe'; 21 | 22 | describe('ElapsedTimePipe', () => { 23 | it('create an instance', () => { 24 | const pipe = new ElapsedTimePipe(); 25 | expect(pipe).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /javascript/drizzle/README-CN.md: -------------------------------------------------------------------------------- 1 | # 使用 Drizzle 连接 OceanBase 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过 [Drizzle](https://orm.drizzle.team) 连接 [OceanBase](https://www.oceanbase.com) 数据库。 6 | 7 | ## 准备工作 8 | 9 | 确保 Node.js 和 npm 已经安装。 10 | 11 | ## 项目使用 12 | 13 | 拉取项目并进入相应目录: 14 | 15 | ```bash 16 | git clone git@github.com:oceanbase/ob-samples.git 17 | cd javascript/drizzle 18 | ``` 19 | 20 | 安装依赖: 21 | 22 | ```bash 23 | npm install 24 | ``` 25 | 26 | 修改 `.env` 中的数据库连接串: 27 | 28 | ```bash 29 | DATABASE_URL="mysql://root:@127.0.0.1:2881/test" 30 | ``` 31 | 32 | 将 `db/schema.ts` 中定义的 `users` 模型同步到数据库中: 33 | 34 | ```bash 35 | npx drizzle-kit push 36 | ``` 37 | 38 | 执行 `index.ts` 中的示例代码: 39 | 40 | ```bash 41 | npx ts-node index.ts 42 | ``` 43 | 44 | 输出以下内容,说明执行成功: 45 | 46 | ```bash 47 | [ { id: 1, email: 'alice@oceanbase.com', name: 'Alice' } ] 48 | ``` 49 | 50 | 查看对应的 `users` 表,数据已正常插入: 51 | 52 | ```bash 53 | mysql> select * from users; 54 | +----+---------------------+-------+ 55 | | id | email | name | 56 | +----+---------------------+-------+ 57 | | 1 | alice@oceanbase.com | Alice | 58 | +----+---------------------+-------+ 59 | 1 row in set (0.01 sec) 60 | ``` 61 | -------------------------------------------------------------------------------- /applications/hertzbeat/common/src/test/java/org/apache/hertzbeat/common/util/Base64UtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.hertzbeat.common.util; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | /** 23 | * Test case for {@link Base64Util} 24 | */ 25 | class Base64UtilTest { 26 | 27 | @Test 28 | void isBase64() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-attr.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 AntV team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-coord.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 AntV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-g2.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 AntV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-scale.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 AntV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-screenfull.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-util.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 AntV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/web-app/src/app/pojo/StatusPageComponentStatus.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import { StatusPageComponent } from './StatusPageComponent'; 21 | import { StatusPageHistory } from './StatusPageHistory'; 22 | 23 | export class StatusPageComponentStatus { 24 | info!: StatusPageComponent; 25 | history!: StatusPageHistory[]; 26 | } 27 | -------------------------------------------------------------------------------- /applications/mydata/internal/crypto/crypto_test.go: -------------------------------------------------------------------------------- 1 | package crypto 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestEncrypt(t *testing.T) { 8 | type args struct { 9 | input string 10 | } 11 | 12 | cases := []struct { 13 | name string 14 | input string 15 | want string 16 | wantErr bool 17 | }{ 18 | {name: "case1", input: "[!@#$%^&*()]"}, 19 | {name: "case1", input: "`1qazZSE$<>?"}, 20 | {name: "case1", input: "@WSXXDR%"}, 21 | {name: "case1", input: "#EDCCFT^"}, 22 | {name: "case1", input: "1234567890"}, 23 | {name: "case1", input: "abcdefghigklmnopqrstuvwxyz"}, 24 | } 25 | 26 | for _, tt := range cases { 27 | t.Run(tt.name, func(t *testing.T) { 28 | decPass, err := Encrypt(tt.input) 29 | if err != nil { 30 | t.Errorf("err:%+v", err) 31 | } 32 | 33 | tt.want, err = Decrypt(decPass) 34 | if err != nil { 35 | t.Errorf("err:%v", err) 36 | } 37 | 38 | if tt.input != tt.want { 39 | t.Errorf("input:%s, want:%s, decPass:%s, err:%v", tt.input, tt.want, decPass, err) 40 | } else { 41 | t.Logf("decPass:%s", decPass) 42 | t.Logf("input:%s", tt.input) 43 | t.Logf("want :%s", tt.want) 44 | } 45 | }) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/backend/LICENSE-taos-jdbcdriver.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 taosdata 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-adjust.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 AntV team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-component.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 AntV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-data-set.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alipay.inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-iconv-lite.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Alexander Shtuchkin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-plyr.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Sam Potts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-process-nextick-args.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 Calvin Metcalf 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE.** 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-slick.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /applications/hertzbeat/script/docker/collector/README.md: -------------------------------------------------------------------------------- 1 | ## Use the buildx to build Docker images that support multiple system architectures 2 | 3 | > https://vuepress.mirror.docker-practice.com/buildx/multi-arch-images/ 4 | 5 | 6 | ```shell 7 | $ docker buildx create --use --name=mybuilder-cn --driver docker-container --driver-opt image=dockerpracticesig/buildkit:master 8 | 9 | # for tencent environment 10 | $ docker buildx create --use --name=mybuilder-cn --driver docker-container --driver-opt image=dockerpracticesig/buildkit:master-tencent 11 | 12 | $ docker buildx create --use --name mybuilder --driver docker-container 13 | 14 | $ docker buildx use mybuilder 15 | 16 | ``` 17 | 18 | #### Build the image 19 | 20 | ```shell 21 | # Use the --platform flag to specify the target platforms for the build --push flag to push the image to a registry 22 | $ docker buildx build --platform linux/arm64,linux/amd64 -t apache/hertzbeat-collector:v1.0.0 . --push 23 | 24 | $ docker buildx build --platform linux/arm64,linux/amd64 -t quay.io/tancloud/hertzbeat-collector:latest . --push 25 | 26 | # Inspect the image info 27 | $ docker buildx imagetools inspect apache/hertzbeat-collector:v1.0.0 28 | 29 | ``` 30 | -------------------------------------------------------------------------------- /applications/mydata/go.mod: -------------------------------------------------------------------------------- 1 | module mydata 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da 7 | github.com/go-sql-driver/mysql v1.8.1 8 | github.com/pingcap/tidb/pkg/parser v0.0.0-20240409135851-ab90c771a215 9 | github.com/pkg/errors v0.9.1 10 | github.com/spf13/cobra v1.8.0 11 | golang.org/x/sync v0.7.0 12 | golang.org/x/text v0.14.0 13 | ) 14 | 15 | require ( 16 | filippo.io/edwards25519 v1.1.0 // indirect 17 | github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect 18 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 19 | github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb // indirect 20 | github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c // indirect 21 | github.com/pingcap/log v1.1.0 // indirect 22 | github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect 23 | github.com/spf13/pflag v1.0.5 // indirect 24 | go.uber.org/atomic v1.11.0 // indirect 25 | go.uber.org/multierr v1.11.0 // indirect 26 | go.uber.org/zap v1.27.0 // indirect 27 | golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect 28 | gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect 29 | ) 30 | -------------------------------------------------------------------------------- /applications/hertzbeat/common/src/test/java/org/apache/hertzbeat/common/util/LruHashMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.hertzbeat.common.util; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | /** 23 | * Test case for {@link LruHashMap} 24 | */ 25 | class LruHashMapTest { 26 | 27 | @Test 28 | void removeEldestEntry() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-core-util-is.txt: -------------------------------------------------------------------------------- 1 | Copyright Node.js contributors. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-gl-matrix.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-hierarchy.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alipay.inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-ngx-echarts.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Xie, Ziyu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /javascript/typeorm/README-CN.md: -------------------------------------------------------------------------------- 1 | # 使用 TypeORM 连接 OceanBase 2 | 3 | [English](README.md) | 简体中文 4 | 5 | 本文介绍如何通过 [TypeORM](https://typeorm.io) 连接 [OceanBase](https://www.oceanbase.com) 数据库。 6 | 7 | ## 准备工作 8 | 9 | 确保 Node.js 和 npm 已经安装。 10 | 11 | ## 项目使用 12 | 13 | 拉取项目并进入相应目录: 14 | 15 | ```bash 16 | git clone git@github.com:oceanbase/ob-samples.git 17 | cd javascript/typeorm 18 | ``` 19 | 20 | 安装依赖: 21 | 22 | ```bash 23 | npm install 24 | ``` 25 | 26 | 修改 `index.ts` 中的数据库连接串: 27 | 28 | ```javascript 29 | const dataSource = new DataSource({ 30 | type: "mysql", 31 | url: "mysql://root:@127.0.0.1:2881/test", 32 | entities: [User], 33 | synchronize: true, 34 | }); 35 | ``` 36 | 37 | 执行 `index.ts`: 38 | 39 | ```bash 40 | npx ts-node index.ts 41 | ``` 42 | 43 | 输出以下内容,说明执行成功: 44 | 45 | ```bash 46 | [ User { id: 1, email: 'alice@oceanbase.com', name: 'Alice' } ] 47 | ``` 48 | 49 | 查看对应的 `users` 表,数据已正常插入: 50 | 51 | ```bash 52 | mysql> select * from users; 53 | +----+---------------------+-------+ 54 | | id | email | name | 55 | +----+---------------------+-------+ 56 | | 1 | alice@oceanbase.com | Alice | 57 | +----+---------------------+-------+ 58 | 1 row in set (0.01 sec) 59 | ``` 60 | -------------------------------------------------------------------------------- /applications/hertzbeat/material/licenses/frontend/LICENSE-ajv-formats.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Evgeny Poberezkin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------