XU XUv0.16.0

Official External Packages

The Xu 0.16.0 SDK bundles the external drivers and their native source resources. The matrix below is scoped to that bundle; API pages display their own package source identity (currently 1.0.2), which differs from the SDK bundle’s 1.0.0 manifest. Do not infer bundled capabilities from a newer API declaration. Drivers cover databases, caches, messaging, object storage and service discovery; check each package for protocol and platform limits.

1. Select the SDK bundle or a fixed source commit

Place your project beside the extracted SDK and declare its bundled packages using a local source locator. Adjust the relative path if you installed the SDK elsewhere:

module: my_app
version: !ver 0.1.0
xu: !ver 0.16.0
require:
  "github.com/xulang-org/packages": file:../xu-v0.16.0/packages

To fetch the source used by this SDK instead, select its full immutable commit:

require:
  "github.com/xulang-org/packages": git:https://github.com/xulang-org/packages.git@96693e6cce8d51eba45e4f68dc12ce06f7a2336b

From your project directory, resolve and lock dependencies, then check and build:

xu install
xu check main.xu --offline
xu build main.xu -o my_app

Module versions and Git tags have separate roles: this bundle declares module version 1.0.0. The fixed source locator above selects the exact source independently of tag availability. Keep xu.lock with your application and consult modules and dependencies for frozen, vendor and proxy workflows.

2. Importing Packages in Source Code

Xu enforces an explicit namespace alias convention for all external packages: alias #full/module/path/pkg. This eliminates global namespace pollution and makes all external dependencies visible directly at the top of the file.

@main

// 1. Standard library modules have no alias; prefixed with #
#database/sql

// 2. External packages declare an alias and full repository path
mysql    #github.com/xulang-org/packages/mysql
redis    #github.com/xulang-org/packages/redis
postgres #github.com/xulang-org/packages/postgres

fn main() int {
    // Access APIs directly through the declared alias
    println("Drivers loaded successfully")
    << 0
}

Important: Do not write #mysql or #redis. External module imports require an explicit alias and full module path. Standard library imports and local package imports (such as #util) follow their own resolution rules. The integrations listed here belong to github.com/xulang-org/packages; other external modules have their own identities.

3. Hands-on Quickstart Examples

Example 1: Using the MySQL Driver with database/sql

The standard library database/sql provides connection pooling, transactions, and result row abstractions; the concrete MySQL driver is implemented by packages/mysql:

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

fn main() int {
    dsn := "root:123456@tcp(127.0.0.1:3306)/test_db?tls=false"
    $db := sql.open(mysql.driver(), dsn)
    db.ping() >>> (err) {
        println("Database ping failed: " + err.msg())
        << 1
    }
    println("Connected to MySQL successfully!")
    db.close() >>> (err) { << 1 }
    << 0
}

Example 2: Redis Client Operations

@main
redis #github.com/xulang-org/packages/redis

fn main() int {
    $client := redis.open("127.0.0.1:6379") >>> (err) {
        println("Redis connect error: " + err.msg())
        << 1
    }
    client.set("app_version", "demo") >>> (err) { << 1 }
    val := client.get("app_version") >>> (err) { << 1 }
    println("Key 'app_version': " + val)
    client.close()
    << 0
}

Example 3: Object Storage with S3 / MinIO

@main
s3 #github.com/xulang-org/packages/s3

fn main() int {
    $client := s3.open("http://127.0.0.1:9000", "access_key", "secret_key", "us-east-1")
    client.put_object("my-bucket", "welcome.txt", "Hello from Xu!", "text/plain") >>> (err) {
        println("S3 upload failed: " + err.msg())
        << 1
    }
    println("Object uploaded successfully")
    << 0
}

4. Package Catalog & One-Line Import Snippets

The packages repository contains 29 service integrations and a shared transport package. You can copy-paste the exact import snippet into your code:

The status columns below describe code paths inspected in the selected SDK’s bundled packages/*.xu sources, including client.xu, authentication files, tls.xu helpers and transport/mod.xu. They are source evidence, not service interoperability or platform acceptance results. unknown means the capability has not been proven here.

TLS paths: HTTPS business requests use the shared TLS connection path; their legacy manual fd pools remain plaintext. A TLS byte-stream helper only provides tls_connect / tls_connect_config and raw reads / writes; it does not establish that the package’s ordinary authenticated client or pool runs over TLS. That integration is explicitly unknown. SMTP STARTTLS and DNS-over-TLS query integration are unknown. The default TLS configuration verifies certificates and hostnames; these source paths have not been exercised against every service here.

Platform: Network drivers use native sockets and are local SDK paths, outside the browser playground subset. Per-OS / architecture acceptance is unknown for every row. SQLite now uses pure Xu sqlite_native dynamic loading, without requiring static .xulib slices. See download boundaries and status.

Category Package Service One-Line Import Snippet API Reference Protocol scope Authentication TLS path Platform / acceptance
DatabasesmysqlMySQL / MariaDBmysql #github.com/xulang-org/packages/mysqlAPI ReferenceMySQL text protocolmysql_native_password; caching_sha2_password rejectedDSN TLS upgrade with certificate / hostname checksNative sockets; acceptance unknown
DatabasespostgresPostgreSQLpostgres #github.com/xulang-org/packages/postgresAPI ReferencePostgreSQL wire 3.0Trust / cleartext / MD5 / SCRAM-SHA-256SSLRequest upgrade; require / verify-ca / verify-fullNative sockets; acceptance unknown
DatabasessqliteSQLite Embeddedsqlite #github.com/xulang-org/packages/sqliteAPI ReferenceEmbedded SQLite C APINot applicable (embedded)Not applicable (no network transport)Pure Xu dynamic loading; no .xulib; target acceptance unknown
DatabasesclickhouseClickHouse Columnarclickhouse #github.com/xulang-org/packages/clickhouseAPI ReferenceHTTP SQL requestsX-ClickHouse-User / Key headersHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
DatabasesmongodbMongoDB Document DBmongodb #github.com/xulang-org/packages/mongodbAPI ReferenceOP_MSG subset; no compression / topology discoveryunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
DatabasescassandraApache Cassandracassandra #github.com/xulang-org/packages/cassandraAPI ReferenceCQL binary v4; startup / queriesunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
Databasesneo4jNeo4j Graph Databaseneo4j #github.com/xulang-org/packages/neo4jAPI ReferenceHTTP Cypher transactions; no Bolt claimHTTP BasicHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
CachesredisRedis High-Speed Cacheredis #github.com/xulang-org/packages/redisAPI ReferenceRESP2 and bounded RESP3 typesPassword AUTH; ACL username support unknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
CachesmemcachedMemcachedmemcached #github.com/xulang-org/packages/memcachedAPI ReferenceText commandsunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
MessagingkafkaApache Kafkakafka #github.com/xulang-org/packages/kafkaAPI ReferenceProduce v3 / Fetch v4 subset; uncompressed recordsunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
MessagingrabbitmqRabbitMQ / AMQPrabbitmq #github.com/xulang-org/packages/rabbitmqAPI ReferenceAMQP 0-9-1 subsetSASL PLAINTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
MessagingnatsNATS High Throughputnats #github.com/xulang-org/packages/natsAPI ReferenceNATS text protocolUser / password CONNECTTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
MessagingmqttMQTT IoT Protocolmqtt #github.com/xulang-org/packages/mqttAPI ReferenceMQTT 3.1.1; QoS 0 / 1CONNECT username / passwordTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
Coordinationetcdetcd v3 Distributed KVetcd #github.com/xulang-org/packages/etcdAPI Referencev3 HTTP/JSON gateway; not native gRPCunknownHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
CoordinationconsulHashiCorp Consulconsul #github.com/xulang-org/packages/consulAPI ReferenceHTTP APIX-Consul-Token headerHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
CoordinationzookeeperApache ZooKeeperzookeeper #github.com/xulang-org/packages/zookeeperAPI ReferenceFour-letter admin commands; not a session clientunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
CoordinationnacosAlibaba Nacosnacos #github.com/xulang-org/packages/nacosAPI ReferenceHTTP OpenAPI subsetunknownHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
SearchelasticsearchElasticsearch / OpenSearchelasticsearch #github.com/xulang-org/packages/elasticsearchAPI ReferenceHTTP/JSON API subsetunknownHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
SearchmeilisearchMeilisearch Enginemeilisearch #github.com/xulang-org/packages/meilisearchAPI ReferenceHTTP/JSON; integer document IDsBearer API keyHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
ObservabilityprometheusPrometheus Metricsprometheus #github.com/xulang-org/packages/prometheusAPI ReferenceText metrics / HTTP PushgatewayunknownHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
ObservabilityinfluxdbInfluxDB Time Seriesinfluxdb #github.com/xulang-org/packages/influxdbAPI ReferenceHTTP API / line protocolAuthorization: TokenHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
Vectors & AImilvusMilvus Vector DBmilvus #github.com/xulang-org/packages/milvusAPI ReferenceREST v2 search; integer IDsBearer token fieldHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
Vectors & AIqdrantQdrant Vector Engineqdrant #github.com/xulang-org/packages/qdrantAPI ReferenceHTTP/JSON API subsetapi-key headerHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
Vectors & AIchromaChroma Embeddings DBchroma #github.com/xulang-org/packages/chromaAPI ReferenceHTTP/JSON API subsetunknownHTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
Storages3AWS S3 / MinIO Protocols3 #github.com/xulang-org/packages/s3API ReferenceS3 HTTP object API subsetAWS SigV4HTTPS request path; fd pools remain plaintextNative sockets; acceptance unknown
ProtocolsgrpcgRPC / HTTP/2 Clientgrpc #github.com/xulang-org/packages/grpcAPI ReferenceHTTP/2 unary; no streaming / compressionunknownHTTPS unary with ALPN h2; fd pool is h2cNative sockets; acceptance unknown
ProtocolswebsocketWebSocket Full-Duplexwebsocket #github.com/xulang-org/packages/websocketAPI ReferenceHTTP Upgrade / WebSocket framesunknownwss via connect_secure; retain transport.ConnNative sockets; acceptance unknown
ProtocolsdnsDNS Custom Resolverdns #github.com/xulang-org/packages/dnsAPI ReferenceTCP DNS A-record queries; not UDPunknownTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
ProtocolssmtpSMTP Mail Deliverysmtp #github.com/xulang-org/packages/smtpAPI ReferenceSMTP mail deliveryAUTH LOGINTLS byte-stream helper; client TLS unknownNative sockets; acceptance unknown
Shared transporttransportTCP / TLS / HTTP framingtransport #github.com/xulang-org/packages/transportAPI ReferenceTCP / TLS; HTTP/1.x response framingApplication-level authentication unknowncrypto/tls via dial; custom tls.ConfigNative sockets; acceptance unknown

5. Boundaries & Production Builds

For more details on MVS resolution, checksum verification, and private proxies, see: Modules and Dependencies Specification and Native Modules Specification.

Build the Metal native library (optional macOS)

Applications that do not import metal do not need to build Metal native assets. Before using Metal GPU compute on Apple Silicon macOS, build its shared dynamic library:

cd packages
python3 metal/native/build.py