XU XUv0.8.8
中文

Docs

External packages

The packages repository is separate from the compiler and standard library. Its root xu.xun manages a single module; mysql, postgres, and the other directories are internal packages of that module and have no independent manifests.

Add a dependency

Place app beside a local packages checkout:

module: app
version: !ver 0.1.0
xu: !ver 0.8.8
require:
  "github.com/xulang-org/packages": file:../packages
xu install app
xu check app/main.xu --offline

Remote versions, Git sources, MVS, locking, and frozen builds

Use a SQL driver

database/sql supplies connection pools, transactions, rows, and the driver contract. Concrete mysql/postgres/sqlite drivers come from packages. This example requires a running MySQL server with mysql_native_password authentication:

@main
#database/sql
mysql #github.com/xulang-org/packages/mysql

fn main() int {
    mut db := sql.open(mysql.driver(), "user:password@tcp(127.0.0.1:3306)/demo?tls=false")
    db.ping() or (err) {
        println(err.msg())
        << 1
    }
    db.close() or (err) {
        println(err.msg())
        << 1
    }
    << 0
}

External paths require an explicit alias: mysql #github.com/xulang-org/packages/mysql. Use the full path identity; #mysql is not the official external package import.

Package catalog

CategoryPackage / APIService
DatabasesmysqlMySQL / MariaDB
DatabasespostgresPostgreSQL
DatabasessqliteSQLite
DatabasesclickhouseClickHouse
DatabasesmongodbMongoDB
DatabasescassandraCassandra
Databasesneo4jNeo4j
CachesredisRedis
CachesmemcachedMemcached
MessagingnatsNATS
MessagingmqttMQTT
MessagingrabbitmqRabbitMQ
MessagingkafkaKafka
Coordinationetcdetcd
CoordinationconsulConsul
CoordinationzookeeperZooKeeper
CoordinationnacosNacos
SearchelasticsearchElasticsearch / OpenSearch
SearchmeilisearchMeilisearch
ObservabilityinfluxdbInfluxDB
ObservabilityprometheusPrometheus
VectorsmilvusMilvus
VectorsqdrantQdrant
VectorschromaChroma
Storages3S3 / MinIO
ProtocolsgrpcgRPC / HTTP/2
ProtocolswebsocketWebSocket
ProtocolsdnsDNS
ProtocolssmtpSMTP

Current boundaries

Each package has its own protocol, authentication, TLS, and pooling scope. MySQL currently rejects TLS and caching_sha2_password; PostgreSQL does not negotiate TLS; gRPC supports cleartext unary calls with bounded messages, with higher-level pool reuse still pending. See each package’s API and source README.

SQLite uses a native C bridge through xu-c-1. In a local packages checkout run make native before importing it. The configured slices are macOS arm64/x64; other targets require matching toolchains and slices. Git source downloads exclude the generated sqlite.xulib, so a remote SQLite distribution needs an archive containing native resources; that release workflow is pending.