Skip to main content

write_to_sql

Function write_to_sql 

Source
pub fn write_to_sql(file_name: &String, sql: &str) -> Result<(), Error>
Expand description

§Name: write_to_sql

§Description: Writes to a sql file and creates the file if it does not exist

§Arguments:

§* name - The name of the file -String

§* sql - The sql to be written to the file - String

This function will be use to generate sql files. This function will take two arguments, the name of the file, and the sql that will be written to the file. The function will create a template that gets passed to the writer. The sql will be written to the file

§Example

use rustyroad::writers::write_to_sql;

write_to_sql(&"test.sql".to_string(), &"SELECT * FROM test;".to_string());

§Result

SELECT * FROM test;