Files
sonr/pkl/orm.pkl
T

228 lines
2.8 KiB
Plaintext
Raw Normal View History

2024-09-11 15:10:54 -04:00
@go.Package { name = "github.com/onsonr/sonr/internal/db/orm" }
2024-09-07 18:12:58 -04:00
2024-09-11 15:10:54 -04:00
module orm
2024-09-07 18:12:58 -04:00
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
class PrimaryKey extends go.Field {
structTags {
2024-09-11 15:10:54 -04:00
["gorm"] = "primaryKey,autoIncrement"
2024-09-07 18:12:58 -04:00
["json"] = "%{name},omitempty"
2024-09-11 15:10:54 -04:00
["query"] = "%{name}"
2024-09-07 18:12:58 -04:00
}
}
class Unique extends go.Field {
structTags {
["gorm"] = "unique"
["json"] = "%{name},omitempty"
}
}
class Default extends go.Field {
defaultValue: String
structTags {
["gorm"] = "default:%{defaultValue}"
["json"] = "%{name},omitempty"
}
}
class NotNull extends go.Field {
structTags {
["gorm"] = "not null"
}
}
class ForeignKey extends go.Field {
references: String
structTags {
["gorm"] = "foreignKey:%{references}"
}
}
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
2024-09-11 15:10:54 -04:00
["param"] = "%{name}"
2024-09-07 18:12:58 -04:00
}
}
2024-09-11 15:10:54 -04:00
class Account {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
name: String
@JsonField
address: String
@JsonField
2024-09-11 15:10:54 -04:00
publicKey: String
2024-09-07 18:12:58 -04:00
@JsonField
createdAt: String?
}
2024-09-11 15:10:54 -04:00
class Asset {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
name: String
@JsonField
symbol: String
@JsonField
decimals: Int
@JsonField
chainId: Int?
@JsonField
createdAt: String?
}
2024-09-11 15:10:54 -04:00
class Chain {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
name: String
@JsonField
networkId: String
@JsonField
createdAt: String?
}
2024-09-11 15:10:54 -04:00
class Credential {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
subject: String
@JsonField
controller: String
@JsonField
attestationType: String
@JsonField
origin: String
@JsonField
2024-09-11 15:10:54 -04:00
credentialId: String
2024-09-07 18:12:58 -04:00
@JsonField
2024-09-11 15:10:54 -04:00
publicKey: String
2024-09-07 18:12:58 -04:00
@JsonField
transport: String
@JsonField
signCount: UInt
@JsonField
userPresent: Boolean
@JsonField
userVerified: Boolean
@JsonField
backupEligible: Boolean
@JsonField
backupState: Boolean
@JsonField
cloneWarning: Boolean
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
2024-09-11 15:10:54 -04:00
class Profile {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: String
@JsonField
subject: String
@JsonField
controller: String
@JsonField
originUri: String?
@JsonField
publicMetadata: String?
@JsonField
privateMetadata: String?
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
2024-09-11 15:10:54 -04:00
class Property {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
profileId: String
@JsonField
key: String
@JsonField
2024-09-11 15:10:54 -04:00
accumulator: String
2024-09-07 18:12:58 -04:00
@JsonField
2024-09-11 15:10:54 -04:00
propertyKey: String
2024-09-07 18:12:58 -04:00
}
2024-09-11 15:10:54 -04:00
class Keyshare {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
2024-09-14 12:47:25 -04:00
data: String
2024-09-07 18:12:58 -04:00
@JsonField
role: Int
@JsonField
createdAt: String?
}
2024-09-11 15:10:54 -04:00
class Permission {
2024-09-07 18:12:58 -04:00
@PrimaryKey
id: UInt
@JsonField
serviceId: String
@JsonField
grants: String
@JsonField
scopes: String
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
2024-09-11 15:10:54 -04:00