|
| 1 | +package strcase |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | +) |
| 6 | + |
| 7 | +func TestConcurrency(t *testing.T) { |
| 8 | + for i := 0; i < 10000; i++ { |
| 9 | + go doConvert() |
| 10 | + } |
| 11 | + |
| 12 | +} |
| 13 | + |
| 14 | +func doConvert() { |
| 15 | + var snakes = []string{"code", "exchange", "pe_ratio", "profit_margin", "updated_date"} |
| 16 | + for _, v := range snakes { |
| 17 | + _ = convertDatabaseNameToCamelCase(v) |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +func convertDatabaseNameToCamelCase(d string) (s string) { |
| 22 | + ConfigureAcronym("price_book_mrq", "PriceBookMRQ") |
| 23 | + ConfigureAcronym("pe_ratio", "PERatio") |
| 24 | + ConfigureAcronym("peg_ratio", "PEGRatio") |
| 25 | + ConfigureAcronym("eps_estimate_current_year", "EPSEstimateCurrentYear") |
| 26 | + ConfigureAcronym("eps_estimate_next_year", "EPSEstimateNextYear") |
| 27 | + ConfigureAcronym("eps_estimate_next_quarter", "EPSNextQuarter") |
| 28 | + ConfigureAcronym("eps_estimate_current_quarter", "EPSEstimateCurrentQuarter") |
| 29 | + ConfigureAcronym("ebitda", "EBITDA") |
| 30 | + ConfigureAcronym("operating_margin_ttm", "OperatingMarginTTM") |
| 31 | + ConfigureAcronym("return_on_assets_ttm", "ReturnOnAssetsTTM") |
| 32 | + ConfigureAcronym("return_on_equity_ttm", "ReturnOnEquityTTM") |
| 33 | + ConfigureAcronym("revenue_ttm", "RevenueTTM") |
| 34 | + ConfigureAcronym("revenue_per_share_ttm", "RevenuePerShareTTM") |
| 35 | + ConfigureAcronym("quarterly_revenue_growth_yoy", "QuarterlyRevenueGrowthYOY") |
| 36 | + ConfigureAcronym("gross_profit_ttm", "GrossProfitTTM") |
| 37 | + ConfigureAcronym("diluted_eps_ttm", "DilutedEpsTTM") |
| 38 | + ConfigureAcronym("quarterly_earnings_growth_yoy", "QuarterlyEarningsGrowthYOY") |
| 39 | + ConfigureAcronym("two_hundred_day_ma", "TwoHundredDayMA") |
| 40 | + ConfigureAcronym("trailing_pe", "TrailingPE") |
| 41 | + ConfigureAcronym("forward_pe", "ForwardPE") |
| 42 | + ConfigureAcronym("price_sales_ttm", "PriceSalesTTM") |
| 43 | + ConfigureAcronym("price_book_mrq", "PriceBookMRQ") |
| 44 | + s = ToCamel(d) |
| 45 | + return |
| 46 | +} |
0 commit comments