pub fn generate_users(&self, count: usize) -> Vec<UserWithKey> {
        let db = Self::get_db();
        let schema = UserDao::new(&db);
        let mut rv = vec![];
        for _ in 0..count {
            let new_user = NewUser {
                full_name: &self.generate_full_name(),
                email: &self.generate_email(),
                phone_num: &self.generate_phone_num(),
                active: true,
                register_time: util::now(),
            };
            let (user, (public_key, secret_key)) =
                schema.create_user(&new_user, None).expect("cannot create user");
            rv.push(UserWithKey::new(user.into(), public_key, secret_key));
        }
        rv
    }
/// Menggenerasikan beberapa akun sekaligus,
/// ini tidak via rest API, tapi langsung ke database.
Menggenerasikan beberapa akun sekaligus,
ini tidak via rest API, tapi langsung ke database.
Menggenerasikan beberapa akun sekaligus ini tidak via rest API tapi langsung ke database .
pub fn generate_users(&self, count: usize) -> Vec<UserWithKey> {
        let db = Self::get_db();
        let schema = UserDao::new(&db);
        let mut rv = vec![];
        for _ in 0..count {
            let new_user = NewUser {
                full_name: &self.generate_full_name(),
                email: &self.generate_email(),
                phone_num: &self.generate_phone_num(),
                active: true,
                register_time: util::now(),
            };
            let (user, (public_key, secret_key)) =
                schema.create_user(&new_user, None).expect("cannot create user");
            rv.push(UserWithKey::new(user.into(), public_key, secret_key));
        }
        rv
    }
pub fn generate_users ( & self , count : usize ) -> Vec < UserWithKey > { let db = Self :: get_db ( ) ; let schema = UserDao :: new ( & db ) ; let mut rv = vec ! [ ] ; for _ in 0 .. count { let new_user = NewUser { full_name : & self . generate_full_name ( ) , email : & self . generate_email ( ) , phone_num : & self . generate_phone_num ( ) , active : true , register_time : util :: now ( ) , } ; let ( user , ( public_key , secret_key ) ) = schema . create_user ( & new_user , None ) . expect ( " " ) ; rv . push ( UserWithKey :: new ( user . into ( ) , public_key , secret_key ) ) ; } rv }
Menggenerasikan beberapa akun sekaligus,
ini tidak via rest API, tapi langsung ke database.
Menggenerasikan beberapa akun sekaligus ini tidak via rest API tapi langsung ke database .
&self
count
usize
&self
count
usize