[doc] fix copilot crap

Signed-off-by: Anton Nesterov <anton@demiurg.io>
This commit is contained in:
Anton Nesterov 2024-08-15 09:10:49 +02:00
parent 7f5c2a32cc
commit 296595cfea
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
5 changed files with 27 additions and 27 deletions

View file

@ -7,10 +7,10 @@ import (
utils "l12.xyz/dal/utils" utils "l12.xyz/dal/utils"
) )
/** /*
* CommonDialect is a simple implementation of the Dialect interface. CommonDialect is a simple implementation of the Dialect interface.
* Should be usable for most SQL databases. Should be usable for most SQL databases.
**/ */
type CommonDialect struct { type CommonDialect struct {
TableName string TableName string
TableAlias string TableAlias string

View file

@ -6,12 +6,12 @@ import (
"time" "time"
) )
/** /*
* DBAdapter DBAdapter
* Automatically creates connections for each database URL. Automatically creates connections for each database URL.
* Executes queries on the specified database. Executes queries on the specified database.
* Closes connections older than ConnectionLiveTime Closes connections older than ConnectionLiveTime
**/ */
type DBAdapter struct { type DBAdapter struct {
Type string Type string
MaxAttempts int MaxAttempts int

View file

@ -6,11 +6,11 @@ var DIALECTS = map[string]Dialect{
"sqlite3": CommonDialect{}, "sqlite3": CommonDialect{},
} }
/** /*
* Register a new dialect for a given driver name. Register a new dialect for a given driver name.
* `driverName` is the valid name of the db driver (e.g. "sqlite3", "postgres"). `driverName` is the valid name of the db driver (e.g. "sqlite3", "postgres").
* `dialect` is an implementation of the Dialect interface. `dialect` is an implementation of the Dialect interface.
**/ */
func RegisterDialect(driverName string, dialect Dialect) { func RegisterDialect(driverName string, dialect Dialect) {
DIALECTS[driverName] = dialect DIALECTS[driverName] = dialect
} }

View file

@ -8,9 +8,9 @@ type Query struct {
type DialectOpts map[string]string type DialectOpts map[string]string
/** /*
* Dialect interface provides general utilities for normalizing values for particular DB. Dialect interface provides general utilities for normalizing values for particular DB.
**/ */
type Dialect interface { type Dialect interface {
New(opts DialectOpts) Dialect New(opts DialectOpts) Dialect
GetTableName() string GetTableName() string

View file

@ -9,15 +9,15 @@ import (
"l12.xyz/dal/proto" "l12.xyz/dal/proto"
) )
/** /*
* QueryHandler is a http.Handler that reads a proto.Request from the request body, QueryHandler is a http.Handler that reads a proto.Request from the request body,
* parses it into a query, executes the query on the provided db and writes the parses it into a query, executes the query on the provided db and writes the
* result to the response body. result to the response body.
* - The request body is expected to be in msgpack format (proto.Request). - The request body is expected to be in msgpack format (proto.Request).
* - The response body is written in msgpack format. - The response body is written in msgpack format.
* - The respose is a stream of rows (proto.Row), where the first row is the column names. - The respose is a stream of rows (proto.Row), where the first row is the column names.
* - The columns are sorted alphabetically, so it is client's responsibility to match them and sort as needed. - The columns are sorted alphabetically, so it is client's responsibility to match them and sort as needed.
**/ */
func QueryHandler(db adapter.DBAdapter) http.Handler { func QueryHandler(db adapter.DBAdapter) http.Handler {
dialect := adapter.GetDialect(db.Type) dialect := adapter.GetDialect(db.Type)
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {