Skip to content

Titanchao/SQLiteCodable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLiteCodable

借鉴alibaba/HandyJSON代码 将model自动存储到数据库

SQLiteManager.setEnvironment("test")
SQLiteManager.initialize("private")
SQLiteManager.prepare { () -> [SQLiteCodable.Type] in
	return [Player.self]
}

class Player: SQLiteCodable {
	var id = 0
	var name = ""
	var time = Date()
    
	required init() {}
    
	func declareKeys(mapper: SQLiteMapper) {
		mapper <<- self.id
		mapper <~~ self.time
	}
}

let player = Player()
player.id = 24
player.name = "Kobe"
player.time = Date()
Player.insert([player])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors