S
S
Sergio_Hunter2016-11-25 21:19:53
go
Sergio_Hunter, 2016-11-25 21:19:53

How to check if a date is unique in Go?

In the cycle of adding dates to the array, you need to check for uniqueness, and if identical elements are found, then you need to sum them up, in other words, the data is unloaded from the database into a csv file in which the dates are duplicated, it must be merged into one. An example if possible, thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pavlyuk, 2016-11-26
@pav5000

Use map for example. You check the presence of the date in the map, if not, then add a value there, if there is, then add the new one to the existing one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question