G
Size: a a a
G
Lr
G
Lr
н
class User(id: Int, name: String)
class UserWithPosts(id: Int, name: String, posts: List[Post])
...
val vasyaWithPosts = UserWithPosts(1, "Vasya", vasyaPosts)
val petya = User(2, "Petya")
...
val vasyaWithoutPosts = into[User] spread vasyaWithPosts :: HNil
val petyaWithPosts = into[UserWithPosts] spread petya :: at["posts"](petyaPosts) :: HNil
DB
G
н
Lr
н
DB
class User(id: Int, name: String)
class UserWithPosts(id: Int, name: String, posts: List[Post])
...
val vasyaWithPosts = UserWithPosts(1, "Vasya", vasyaPosts)
val petya = User(2, "Petya")
...
val vasyaWithoutPosts = into[User] spread vasyaWithPosts :: HNil
val petyaWithPosts = into[UserWithPosts] spread petya :: at["posts"](petyaPosts) :: HNil
public static TResult Spread<TModel, TResult>(this iEnumerable<TModel> collection, Func<iEnumerable<TModel>, TResult> func) => func(collection);
DB
н
public static TResult Spread<TModel, TResult>(this iEnumerable<TModel> collection, Func<iEnumerable<TModel>, TResult> func) => func(collection);
DB
function sum(x, y, z) {
return x + y + z;
}
const numbers = [1, 2, 3];
sum(...numbers);
н
into[UserWithPosts] spread petya :: at["posts"](petyaPosts) :: HNil
new UserWithPosts(
id = petya.id,
name = petya.name,
posts = petyaPosts
)
DB
н
ыы