val source: String = System.getProperty("user.dir")
class Generator : GeneratorConfig {
private var replaceIfNecessary = false
override fun createConfig(config: Config) {
}
inner class Template {
...
}
data class Model(...)
}
Slide 15
Slide 15 text
Program
Structure
Interface
Slide 16
Slide 16 text
PSI
• Provides hierarchal content of code
• Works across languages
Source Code as Data
Source
Code
@Serializable
data class ParsedFile(
var name: String,
var doc: String? = null,
@SerialName("classes")
var parsedClasses: List? = null,
@SerialName("functions")
var parsedFunctions: List? = null,
@SerialName("properties")
var parsedVariables: List? = null
)
Slide 39
Slide 39 text
Source Code as Data
Source
Code
@Serializable
data class ParsedFile(
var name: String,
var doc: String? = null,
@SerialName("classes")
var parsedClasses: List? = null,
@SerialName("functions")
var parsedFunctions: List? = null,
@SerialName("properties")
var parsedVariables: List? = null
)
SqlDelight
CREATE TABLE Photos (
id INTEGER NOT NULL,
title TEXT NOT NULL
);
insert:
INSERT INTO Photos (id, title) VALUES (?, ?);
getAll:
SELECT * FROM Photos;
Slide 52
Slide 52 text
SqlDelight
interface PhotoQueries : Transacter {
fun getAll(mapper: (
id: String,
title: String
) -> T): Query
fun getAll(): Query
fun insert(
id: String,
title: String
)
}
Slide 53
Slide 53 text
val db = Database(AndroidSqliteDriver(Database.Schema, context, “photo.db”))
db.photoQueries.getAll() -> List
SqlDelight - MPP
Slide 54
Slide 54 text
No content
Slide 55
Slide 55 text
T.use()
Slide 56
Slide 56 text
T.use()
codeString
.lineSequence()
.map { line -> }