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 --offlineRemote 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
| Category | Package / API | Service |
|---|---|---|
| Databases | mysql | MySQL / MariaDB |
| Databases | postgres | PostgreSQL |
| Databases | sqlite | SQLite |
| Databases | clickhouse | ClickHouse |
| Databases | mongodb | MongoDB |
| Databases | cassandra | Cassandra |
| Databases | neo4j | Neo4j |
| Caches | redis | Redis |
| Caches | memcached | Memcached |
| Messaging | nats | NATS |
| Messaging | mqtt | MQTT |
| Messaging | rabbitmq | RabbitMQ |
| Messaging | kafka | Kafka |
| Coordination | etcd | etcd |
| Coordination | consul | Consul |
| Coordination | zookeeper | ZooKeeper |
| Coordination | nacos | Nacos |
| Search | elasticsearch | Elasticsearch / OpenSearch |
| Search | meilisearch | Meilisearch |
| Observability | influxdb | InfluxDB |
| Observability | prometheus | Prometheus |
| Vectors | milvus | Milvus |
| Vectors | qdrant | Qdrant |
| Vectors | chroma | Chroma |
| Storage | s3 | S3 / MinIO |
| Protocols | grpc | gRPC / HTTP/2 |
| Protocols | websocket | WebSocket |
| Protocols | dns | DNS |
| Protocols | smtp | SMTP |
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.