From 63c64059447751d000e874c172c4ba7684a5f2d7 Mon Sep 17 00:00:00 2001 From: NullSablex <244216261+NullSablex@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:55:39 -0300 Subject: [PATCH] adiciona o mkdocs e o uso do github pages. --- .github/workflows/docs.yml | 29 +++++++++++ docs/index.md | 99 ++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 67 ++++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..3e9d436 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,29 @@ +name: Docs + +on: + push: + branches: + - master + paths: + - 'docs/**' + - 'mkdocs.yml' + workflow_dispatch: + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Instalar MkDocs + run: pip install mkdocs-material + + - name: Deploy GitHub Pages + run: mkdocs gh-deploy --force diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..fd05d3b --- /dev/null +++ b/docs/index.md @@ -0,0 +1,99 @@ +# Documentação — mysql_samp + +Plugin MySQL para SA:MP e open.mp escrito em Rust. Zero dependências externas, queries non-blocking, cache e ORM integrados. + +--- + +## Por onde começar? + +
+ +- :material-download: **Novo por aqui** + + --- + + Instale o plugin e configure sua primeira conexão. + + [Instalação](instalacao.md) · [Conexão](conexao.md) + +- :material-swap-horizontal: **Migrando do R41-4** + + --- + + Veja o que mudou e adapte seu código existente. + + [Guia de migração](migracao.md) · [O que mudou](mudancas.md) + +- :material-book-open-variant: **Referência** + + --- + + Tabela completa de natives, forwards e enums. + + [API completa](api.md) + +- :material-speedometer: **Benchmark** + + --- + + Resultados de desempenho em cenários reais. + + [Ver benchmark](benchmark.md) + +
+ +--- + +## Exemplo mínimo + +Conexão, query assíncrona e leitura do resultado no callback: + +```pawn +#include + +new MySQL:g_mysql; + +public OnGameModeInit() +{ + g_mysql = mysql_connect("127.0.0.1", "root", "senha", "banco"); + + // Query FIFO (non-blocking) — executa em thread separada + mysql_query(g_mysql, "SELECT id, nome FROM jogadores LIMIT 5", "OnJogadoresCarregados", ""); + return 1; +} + +forward OnJogadoresCarregados(errorid, error[]); +public OnJogadoresCarregados(errorid, error[]) +{ + if (errorid != 0) { + printf("[MySQL] Erro %d: %s", errorid, error); + return; + } + + while (cache_next_row()) { + new id, nome[MAX_PLAYER_NAME]; + cache_get_value_name_int("id", id); + cache_get_value_name("nome", nome); + printf("Jogador #%d: %s", id, nome); + } +} + +public OnGameModeExit() +{ + mysql_close(g_mysql); + return 1; +} +``` + +--- + +## Tópicos + +| Tópico | Descrição | +|---|---| +| [Queries](queries.md) | `mysql_query`, `mysql_pquery`, `mysql_format`, escape de strings | +| [Cache](cache.md) | Leitura de resultados, navegação entre linhas, cache salvo | +| [ORM](orm.md) | Mapeamento de variáveis Pawn para colunas, CRUD automático | +| [Options](options.md) | Configuração de porta, charset, timeout e outros | +| [Segurança](seguranca.md) | Proteção contra SQL injection, limites e boas práticas | +| [Erros](erros.md) | `mysql_errno`, `OnQueryError`, códigos de erro do MySQL | diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..17f291a --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,67 @@ +site_name: mysql_samp +site_description: Plugin MySQL para SA:MP escrito em Rust +site_url: https://nullsablex.github.io/mysql_samp +repo_url: https://github.com/NullSablex/mysql_samp +repo_name: NullSablex/mysql_samp +edit_uri: edit/master/docs/ + +theme: + name: material + language: pt + palette: + - scheme: default + primary: deep orange + accent: orange + toggle: + icon: material/brightness-7 + name: Modo escuro + - scheme: slate + primary: deep orange + accent: orange + toggle: + icon: material/brightness-4 + name: Modo claro + features: + - navigation.tabs + - navigation.sections + - navigation.top + - search.highlight + - search.suggest + - content.code.copy + - content.action.edit + +plugins: + - search: + lang: pt + +markdown_extensions: + - admonition + - pymdownx.details + - pymdownx.superfences + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.tabbed: + alternate_style: true + - tables + - toc: + permalink: true + +nav: + - Início: index.md + - Guia: + - Instalação: instalacao.md + - Conexão: conexao.md + - Queries: queries.md + - Cache: cache.md + - ORM: orm.md + - Options: options.md + - Segurança: seguranca.md + - Erros: erros.md + - Migração: + - Guia de Migração: migracao.md + - O que Mudou: mudancas.md + - Exemplos: exemplos-migracao.md + - Referência: + - API Completa: api.md + - Benchmark: benchmark.md