From ffd271f0baa11c4a86c7248963328df94fbeb58e Mon Sep 17 00:00:00 2001 From: Kyle Lin Date: Wed, 6 Sep 2023 21:44:15 +0800 Subject: [PATCH 1/2] Remove example code files --- example.v | 103 ------------------------------------- example_custom_attribute.v | 59 --------------------- 2 files changed, 162 deletions(-) delete mode 100644 example.v delete mode 100644 example_custom_attribute.v diff --git a/example.v b/example.v deleted file mode 100644 index e92d5f1..0000000 --- a/example.v +++ /dev/null @@ -1,103 +0,0 @@ -module main - -import vaker -import time - -struct St { - latitude f32 ['vaker:lat'] - longitude f32 ['vaker:long'] - credit_card_number string ['vaker:cc_number'] - credit_card_type string ['vaker:cc_type'] - email string ['vaker:email'] - domain_name string ['vaker:domain_name'] - ipv4 string ['vaker:ipv4'] - ipv6 string ['vaker:ipv6'] - password string ['vaker:password'] - jwt string ['vaker:jwt'] - phone_number string ['vaker:phone_number'] - mac_address string ['vaker:mac_address'] - url string ['vaker:url'] - user_name string ['vaker:user_name'] - toll_free_phone_number string ['vaker:toll_free_phone_number'] - e164phone_number string ['vaker:e164_phone_number'] - title_male string ['vaker:title_male'] - title_female string ['vaker:title_female'] - first_name string ['vaker:first_name'] - first_name_male string ['vaker:first_name_male'] - first_name_female string ['vaker:first_name_female'] - last_name string ['vaker:last_name'] - name string ['vaker:name'] - unix_time i64 ['vaker:unix_time'] - date string ['vaker:date'] - time string ['vaker:time'] - time_time time.Time ['vaker:time'] - month string ['vaker:month'] - year string ['vaker:year'] - day_of_week string ['vaker:day_of_week'] - timestamp string ['vaker:timestamp'] - century string ['vaker:century'] - time_zone string ['vaker:timezone'] - period string ['vaker:period'] - word string ['vaker:word'] - sentence string ['vaker:sentence'] - paragraph string ['vaker:paragraph'] - currency string ['vaker:currency'] - amount f64 ['vaker:amount'] - amount_with_currency string ['vaker:amount_with_currency'] - uuid_hypenated string ['vaker:uuid_hyphenated'] - uuid string ['vaker:uuid_digit'] - skip string ['vaker:skip'] - str_len5 string ['vaker:str_len=5'] // Default len is set to 10 -} - -fn main() { - st := St{} - vaker.fake_data(&st) - println(st) -} - -// St{ -// latitude: 235.8904 -// longitude: -118.9505 -// credit_card_number: '6011854711796225' -// credit_card_type: 'JCB' -// email: 'FaAxiad@URuRxMv.ru' -// domain_name: 'khqxRYv.org' -// ipv4: '23.82.36.98' -// ipv6: '3de3:7747:6609:6769:1399:a313:08da:9223' -// password: 'DjHuDLioRoAPTEuQDiYSlgcMNfuWVIZdnxEiQtTyilxEgermMe' -// jwt: 'BDsQeOATfFbjUBZGvTSgCQIHfyZkuMGNYhZKtbEq.BDsQeOATfFbjUBZGvTSgCQIHfyZkuMGNYhZKtbEq.BDsQeOATfFbjUBZGvTSgCQIHfyZkuMGNYhZKtbEq' -// phone_number: '534-622-4186' -// mac_address: '9f:6e:f9:7f:c0:2d' -// url: 'http://kjUVQod.biz/aLUYZrc.html' -// user_name: 'RttlAMo' -// toll_free_phone_number: '(777) 239-658600' -// e164phone_number: '+8373926674' -// title_male: 'Dr.' -// title_female: 'King' -// first_name: 'Malvina' -// first_name_male: 'Afton' -// first_name_female: 'Yazmin' -// last_name: 'Powlowski' -// name: 'Lady Ericka Vandervort' -// unix_time: 6458965484626575704 -// date: '2004-04-27' -// time: '01:02:53' -// month: 'Mar' -// year: '1991' -// day_of_week: 'Friday' -// timestamp: '2007-02-27 11:27:07' -// century: 'XIII' -// time_zone: 'Africa/Lagos' -// period: 'PM' -// word: 'temporibus' -// sentence: 'Corporis' -// paragraph: 'Dignissimos quae ipsa. Accusantium fuga. Eligendi voluptatem a enim illum. Et quis. Soluta libero officia aut non rerum.' -// currency: 'BMD' -// amount: 77758.85 -// amount_with_currency: '47863.59 XPT' -// uuid_hypenated: '838bd7e3-a3f3-4183-8a18-9bfa6bb7dd0d' -// uuid: 'a1b4dc9f0a6b4008a4eeeef47e30e6a0' -// skip: '' -// str_len5: 'Vck^K' -// } diff --git a/example_custom_attribute.v b/example_custom_attribute.v deleted file mode 100644 index b697779..0000000 --- a/example_custom_attribute.v +++ /dev/null @@ -1,59 +0,0 @@ -module main - -import vaker - -struct Example { - my_word string ['chaos:my_word'] - int_field int ['chaos:multiple_type'] - i64_field i64 ['chaos:multiple_type'] -} - -fn main() { - mut custom_df := vaker.new_df() - custom_df.register('chaos') - custom_df.register_fn[string]('chaos', 'my_word', my_word)? - custom_df.register_fn[int]('chaos', 'multiple_type', multiple_type)? - custom_df.add_type[i64]('chaos', 'multiple_type')? - ex := Example{} - vaker.fake_data_wdf(&ex, &custom_df) - println(ex) - - // Example{ - // my_word: 'I am ChAoS!' - // int_field: 50 - // i64_field: 100 - // } -} - -fn my_word(ptr vaker.PtrInfo) { - pointer := &string(ptr.ptr) - unsafe { - *pointer = 'I am ChAoS!' - } -} - -fn multiple_type(ptr vaker.PtrInfo) { - // unsafe { - // if ptr.sz == 4 { - // // int - // pointer := &int(ptr.ptr) - // *pointer = 50 - // } else { - // // you should assume it's long, otherwise, there'll be no other possible castings - // pointer := &i64(ptr.ptr) - // *pointer = 100 - // } - // } - - // alternative: check by type idx (Enhanced way to check type) - unsafe { - if vaker.is_type[int](ptr) { - // int - vaker.cast_assign[int](ptr, 50) - } else if vaker.is_type[i64](ptr) { - // i64 - vaker.cast_assign[i64](ptr, 100) - } - // You don't have to handle the unmatched types, they've been checked before faking phase - } -} From 1275e68492a80866b8526a87e76e86769fb3fe06 Mon Sep 17 00:00:00 2001 From: Kyle Lin Date: Wed, 6 Sep 2023 23:10:27 +0800 Subject: [PATCH 2/2] Remove unused submodule & prepare for release launch --- .gitmodules | 3 --- Vaker-doc | 1 - v.mod | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 .gitmodules delete mode 160000 Vaker-doc diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ac24832..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Vaker-doc"] - path = Vaker-doc - url = https://github.com/ChAoSUnItY/Vaker-doc diff --git a/Vaker-doc b/Vaker-doc deleted file mode 160000 index b943f18..0000000 --- a/Vaker-doc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b943f18736036788cf2a6caa02dc6384b53035f2 diff --git a/v.mod b/v.mod index 54b8616..99e8b22 100644 --- a/v.mod +++ b/v.mod @@ -1,7 +1,7 @@ Module { name: 'vaker' description: 'A light-weight data faker written in V Lang' - version: '0.2.1' + version: '0.3.0' license: 'MIT' dependencies: [] }