--- title: Multi Code Component Examples description: Multi Code Component Examples slug: multicode category: getting-started status: draft --- import MultiCode from '@commons-components/Code/MultiCode.astro'; In this examples, we will show how to use the `MultiCode` component: - Here the definition of the `MultiCode` component. - Here the definition of the `Code` component that is used inside the `MultiCode` component. In these two files there are the TypeScript definitions usefull to know all the avaible properties. The MultiCode --- ## First example export const WebliteSourceCode = `
`; export const SwiftSourceCode = `let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey") let sqliteCloud = SQLiteCloud(configuration) do { try await sqliteCloud.connect() debugPrint("connected") } catch { debugPrint("connection error: \(error)") // SQLiteCloudConnectionError }`; export const codeExamplesOne = [ { sliderItem: "Web", codeLines: WebliteSourceCode, lang: "html", // docHref: "htts://google.com", gitHref: "htts://google.com", }, { sliderItem: "Swift", lang: "swift", codeLines: SwiftSourceCode, docHref: "", gitHref: "", } ]; --- ## Second example export const PHPSourceCode = `$sqliteCloudConnectionString = 'sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey'; $sqlite = new SQLiteCloudClient(); $sqlite->connectWithString($sqliteCloudConnectionString);`; export const JSSourceCode = `import SQLiteCloud from 'sqlitecloud-sdk' const client = new SQLiteCloud(projectId, apikey, onErrorCallback, onCloseCallback); await client.connect(); const database = "chinook.db" let name = 'Breaking The Rules' let results = await localClient.exec(\`USE DATABASE \${database}; SELECT * FROM tracks WHERE name = \${name}\`);`; export const NodeSourceCode = `import { Database } from 'sqlitecloud-js' let database = new Database('sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey') let name = 'Breaking The Rules' let results = await database.sql\`\`SELECT * FROM tracks WHERE name = \${name}\`\` `; export const codeExamplesTwo = [ { sliderItem: "PHP", codeLines: PHPSourceCode, lang: "php", // docHref: "htts://google.com", gitHref: "htts://google.com", }, { sliderItem: "Web", lang: "javascript", codeLines: JSSourceCode, docHref: "", gitHref: "", }, { sliderItem: "NodeJS", lang: "javascript", codeLines: NodeSourceCode, docHref: "", gitHref: "", } ];